Forum Discussion
Power BI GET-Methode with token as request header
- Anonymous4 years ago
Hi Anonymous ,
I think you can follow the below step to get access token and get data from API.
- Get Access token in Power BI Desktop:
() => let body = "client_id=" & #"App ID" & "&scope=https://analysis.windows.net/powerbi/api/.default&client_secret=" & #"App Secret" & "&grant_type=client_credentials", Data= Json.Document(Web.Contents("https://login.microsoftonline.com/"& TenantID & "/oauth2/v2.0/token/", [Headers=[#"Content-Type"="application/x-www-form-urlencoded"], Content=Text.ToBinary(body)])), access_token = Data[access_token] in access_tokenBest Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous4 years ago
HI everyone
Sorry for delay, I had to take a little Corona break.
The solution works fine now, thanks to all.
regards
Mulder
Anonymous , Not very sure on get part. but check if these can help
https://community.powerbi.com/t5/Power-Query/OAuth2-REST-API-as-data-source/td-p/414748
- Anonymous4 years agoNot applicable
HI amitchandak
PREVIEWI have read everything from Chris Webb, it helps to build the POST-Method to get the token.But it isn't a Bearer Token. i try serval times, but it dont work.there ist also a solution from Diogenes Santos wiht Bearer Token like this:authToken = "bearer " & token, //Required by documentation.
[Headers=[Authorization=authToken]]
It seems like i cant use the Authorization Methode like this.
The same when i try to fill the OAuth Token in swagger, it doesent work.
But Thanks fpr reply
Regards