Bridge: Data Reference Doesn't Return Same as Hardcoded Value
I'm connected to an external API that requires a token to be added as a Request Header for calls. The token cannot be hardcoded to the call since it expires every hour. So I must make a call to refresh the token then use that in subsequent call's Header.
When I pass the token as a data reference to the Header of the subsequent call, the API returns a 401 error. (For the screenshot below I removed the first call to get the token and I'm just passing the token string from the JS). I get the same error whether it comes from the JS or from the call directly.
But when I provided the token directly in the Value, it returns 200 success…
Do I need to "clean" the Bridge data reference somehow? I'm stumped.
Answers
-
Leaving this out there for anyone that comes across it…
I solved for this by bringing the first call's result (token) into JS and prefacing it with the 'Bearer ' in the same variable and returning that as a single data point. I then referenced that in the Header Value field of the subsequent call.
-
That's interesting Ryan. Do you think it's because you ended up with something like
'Bearer 'token' ' ?
-
@Brian_Richardson unfortunately, it doesn't show me the data it sends, so I'm not sure, but I'm guessing it was either that or it was adding quotes around the token text.
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.6K Get Help
- 433 Global Discussions
- 136 Industry Talk
- 466 Announcements
- 4.9K Ideas & Feature Requests
- 143 Brandfolder
- 147 Just for fun
- 64 Community Job Board
- 466 Show & Tell
- 32 Member Spotlight
- 2 SmartStories
- 298 Events
- 36 Webinars
- 7.3K Forum Archives