Forum Discussion
Passing a bearer token to copy data action using GET
Hi All,
Not a question, but something I ran into, as I am just picking up MS Fabric, pipelines etc.
I needed to use web request, to get an access token that is valid for 30 minutes. Next I needed to use that token as a bearer token to do a follow up API call to get actual data , there didn't seem to be that much info around, when I tried to google it. Eventually I found a you tube video, that told me what i needed to know. (linked below). Things like apikeys and other credentials will of course vary on the API yo are trying to use.
This is my flow.
Step 1
Do your web request
Step 2 link the Web and copy data action
Step 3 In the copy data action set it up as follows:
As you can see the value of the Authorization header is dynamic, with in my case, the following expression:
The part ".access_token" depends on the json you get returned, in my case it was a very flat structure with no above array.
Above you can see where i got the parameter access_token from. If this array had been nested in for instance another array called "data" then the value would have been data.access_token in stead of just access_token.
I hope this is usefull info to share here. The video I got this from you can find here .
Cheers
Hans
Good morning,
Yes just sharing knowledge, since it wasn't so straightforward to find as I thought it would be
Cheers
Hans
5 Replies
- AnonymousNot applicable
Hi smeetsh ,
Thanks for using Fabric Community.
Can you please confirm whether this is a question or just sharing the knowledge across the Community?
As I understand you are just sharing the knowledge across the Community.- smeetshContinued Contributor
Good morning,
Yes just sharing knowledge, since it wasn't so straightforward to find as I thought it would be
Cheers
Hans
- 0simmis0New Member
Thank you!
- KruppsNew Member
You should not put a token in directly, instead use @concat('Bearer ', activity('Get Auth Token').output.access_token)
- smeetshContinued Contributor
Which is exactly what id did