Forum Discussion
ronaldbalza2023
4 years agoContinued Contributor
oauth2 api connection
Hi everyone, is there any tutorial, links that provide step by step process on how to connect with an oauth2 api?
Appreciated all the help 🙂
2 Replies
- negi007Community Champion
ronaldbalza2023 you can try below links
translate to english
https://growteq.nl/2017/01/11/self-service-data-ophalen-vanuit-exact-online-in-power-bi/
https://community.powerbi.com/t5/Power-Query/Pull-data-from-a-REST-API-Authentication/td-p/246006
https://community.powerbi.com/t5/Power-Query/OAuth2-REST-API-as-data-source/td-p/414748
- AnonymousNot applicable
HI ronaldbalza2023,
Here is some codesnap about using web connector with the rest API authorization, you can check if it helps:
let secretId = xxxxx, authKey = "Basic " & secretId, url = "https://api.xxxxx.com/oauth2/token", GetJson = Web.Contents( url, [ Headers = [ #"Authorization" = authKey, #"Content-Type" = "application/x-www-form-urlencoded;charset=UTF-8" ], Content = Text.ToBinary("grant_type=client_credentials") ] ), token = Json.Document(GetJson)[access_token], Result = Web.Contents( "https://xxxxx.xxx.com", [ Headers = [ #"Content-Type" = "application/json", Authorization = "Bearer " + token, RelativePath = "/xxxxx/xxxxx" ] ] ) in ResultRegards,
Xiaoxin Sheng