Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I am getting data from an API that requires an authorization token to be passed in the connection string. Since the token needs to be renewed every 7 days, I want to read the token from a text file and reference that in the connection string (making it easier to replace the token)
I am able to read the token from the text file.
I read the token and store it in a variable "MyToken"
When I use the variable in a connection string :
I get this error :
Any idea what I can do to fix the issue?
Solved! Go to Solution.
Hi @YasirKazi77 ,
You can right click your token column and Add as New Query. Then create a parameter suggested value as Query and use the Token Query. Then use the Parameter in your api query.
For more details you can refer to below video, it will show you how to generate the token in Power BI and then add the token into your api query for authentication dynamiclly.
Video:https://www.youtube.com/watch?v=N8qYRSqRz84
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @YasirKazi77 ,
You can right click your token column and Add as New Query. Then create a parameter suggested value as Query and use the Token Query. Then use the Parameter in your api query.
For more details you can refer to below video, it will show you how to generate the token in Power BI and then add the token into your api query for authentication dynamiclly.
Video:https://www.youtube.com/watch?v=N8qYRSqRz84
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@YasirKazi77 , refer if this can help
https://www.advaiya.com/generate-dynamic-token-and-get-data-from-custom-api-in-power-bi/
Thanks Amit. I see that the solution you mentioned involves hard coding the username and password into the script , something that I want to avoid.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
88 | |
63 |