Forum Discussion
mschoenhub
3 years agoFrequent Visitor
Cannot apply operator & to types Text and Function
Dear all, I am trying to use a bearer token which I get from a function in a query. Function: () =>
let
// Get the API Token
api_url = "https://api.xxxxxxx.com",
token_path = "/o...
- 3 years ago
Ha mschoenhub ,
that was a tricky one 🙂
In the function for the token, you are not returning the last step.
Please change it to this:() => let // Get the API Token api_url = "https://api.xxxxxxx.com", token_path = "/oauth2/access_token", ClientID = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", Secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", EncodedCredentials = "Basic " & Binary.ToText(Text.ToBinary(ClientID & ":" & Secret), BinaryEncoding.Base64), Token_Response = Json.Document(Web.Contents(api_url, [ RelativePath = token_path, Headers = [#"Content-Type"="application/x-www-form-urlencoded",#"Authorization"=EncodedCredentials], Content=Text.ToBinary("grant_type=client_credentials") ] ) ), // Get the token from the API response token = Token_Response[access_token] in token
ImkeF
3 years agoCommunity Champion
I would suggest to use a web monitoring tool like Fiddler to compare the 2 requests sent to determine what might be wrong here.