Forum Discussion
numersoz
7 years agoHelper III
Power Query Open ID and OAuth 2.0 Rest API
Hello, I have a RESTful API where it has two-factor authentication. First, it used my username and password to get a Bearer authentication key using OpenID. After this with the authentication key,...
- 7 years ago
let token_url = "tokenurl.com", api_base_url = "apiurl.com", qry_str = "?myparameter", body="grant_type=password&client_id=CLIENTID&client_secret=PASSWORD&username=EMAIL&password=PASSWORD", Source = Json.Document(Web.Contents(token_url, [ Headers = [#"Content-Type"="application/x-www-form-urlencoded"], Content=Text.ToBinary(body) ] ) ), token = Source[access_token], data= Json.Document(Web.Contents(api_base_url&qry_str, [ Headers = [ #"Authorization"="Bearer "&token,#"Content-Type"="application/json"] ] ) ), in dataI finally got it working with this code. Thanks for the support.
tonmcg
7 years agoResolver II
Does this API require the client_id and client_secret to be query parameters or placed within the request header?