Howdy, i'm new to BC custom integrations. I'm trying to get an oauth integration setup. I've gotten the pre-auth script built out but am not sure how to get the authorization code that is recived out of the script to be used in an action. Any help would be appreciated.
Hey
Open Thread in Slack
so in your pre-request script after you've gotten the API key, you ultimately have to return request data back which is used to execute the action you're creating
Open Thread in Slack
so in the script, I'd set the request headers and include the authorization code
Open Thread in Slack
I'll see if I can find an example.
Open Thread in Slack
that'd be great i tried setting it as the request.body and returning the body but not sure how to assign that to a secret to be used in the header for an action.
Open Thread in Slack
Open Thread in Slack
From your script above, I'm guessing you'll need to grab the token out of there and callback to the webhook with it in the headers. In the video we're manipulating the webhook URL, but the same applies to the webhook headers.
Open Thread in Slack
Ahh, so every action in workflows is a webhook. So you'll have to attach that script to a webhook for it to show up in your workflows
Open Thread in Slack
What you could do is, create a webhook that is making the same request you're making in the script. That'll return a token as a dynamic field so you can use it in later actions, if that's what you're looking for.
Open Thread in Slack
Yep, webhook to get the token and webhook to take the action, taking the token in as a dynamic field.
Open Thread in Slack
Really, best practice is to use an action pre-request script to get the token, then set that in headers for the attached webhook. Essentially the same thing you see in that video, just change out the getUserId function for a getToken function.
This will likely give you the best results. You can re-use that script for any other actions this was as well.
Open Thread in Slack
which is what i was trying to do, but didn't realize that the action was a webhook
Open Thread in Slack
No problem. Remember, we also have office hours too that we can work through this stuff with you if you're interested. https://calendly.com/eag-consult/custom-integrations-office-hours
Open Thread in Slack
Reply
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.