Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hello (not sure if my last post sent through).
I am calling an API service in Power BI and need to authenticate using Authorization header and Bearer Token. I need to fetch a new token weekly.
Right now, the token value is hard-coded into my Advanced Editor code for each endpoint (see sample code below), but I would like to call a parameter for this instead. I've tried using standard parameter syntax, but am having trouble.
Here is the current M code that is calling the API:
let
Source = Json.Document(Web.Contents("Request URL", [Headers=[Authorization="Bearer eyJhbGciOiJub25lIiwi...."]])),
Data = Source[Data],
#"Converted to Table" = Record.ToTable(Data),
Value = #"Converted to Table"{0}[Value],
#"Converted to Table1" = Table.FromList(Value, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table1", "Column1", {"id", "name"}, {"id", "name"})
in
#"Expanded Column1"
I have set up a parameter for the Bearer Token and want to feed that into the code above (see red bold text):
Can someone help me out with the syntax? How can I modify the M to accept the parameter value for my token?
Thank you!!
Thanks for the reply, but I can get the token no problem - what I really need is just the syntax to load the parameter value into the Authorization header value in the Advanced Editor. Can you help with that?
@angeloola did you ever get this to work? I have the same problem. I have the powerquery returning a token but I want to store that in a variable that can be used by other tables.
Hello, I'm very interested about this subject.
I don't use embed power bi, in query, I am using 2 different acess token about the saas application where the data are stored.
The answer of your question : look this video, I'm sure you'll find the solution of your problem.
https://www.youtube.com/watch?v=2RZkc_qrV1g
And be careful about this: https://docs.microsoft.com/en-us/power-bi/admin/desktop-privacy-levels
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
87 | |
81 | |
53 | |
38 | |
35 |