Forum Discussion
Falcon
4 years agoHelper I
Connect API oauth2 to pull data
Hello Everyone, I am trying to pull API data using oauth2. I have been following different methods online without success. All I have are token URL: https://xxxxxxxx/api/v2/oauth/token client_id:...
- 4 years ago
Falcon
I've just noticed that the json was malformed + I've added a relative path for the auth.
Try this:let ClientId = "XXXXXXX", ClientSecret = "XXXXXXX", Uri = "https://secure9.aladtec.com/", Body ="{ ""grant_type"": ""client_credentials"", ""client_id"": """ & ClientId & """, ""client_secret"": """ & ClientSecret & """ }", OAuth2Response = Web.Contents(Uri, [RelativePath = "mohcacc/api/v2/oauth/token", Content=Text.ToBinary(Body)]) in OAuth2Response
SpartaBI
4 years agoCommunity Champion
Falcon
I've just noticed that the json was malformed + I've added a relative path for the auth.
Try this:
let
ClientId = "XXXXXXX",
ClientSecret = "XXXXXXX",
Uri = "https://secure9.aladtec.com/",
Body ="{
""grant_type"": ""client_credentials"",
""client_id"": """ & ClientId & """,
""client_secret"": """ & ClientSecret & """
}",
OAuth2Response = Web.Contents(Uri, [RelativePath = "mohcacc/api/v2/oauth/token", Content=Text.ToBinary(Body)])
in
OAuth2Response