Forum Discussion
Anonymous
5 years agoNot applicable
Missing Authorization in connection string
Hi! I have a report that retrieves data via an API. The code looks like this: Source = Json.Document(Web.Contents("https://XXXX/api/external/statistics/v1?from_date=2020-09-01&to_date=2020-10...
PhilipTreacy
5 years agoSuper User
Hi Anonymous
What type of Auth is it?
How does the Auth need to be provided? In encoded form like this?
EncodedCredentials = "Basic " & Binary.ToText(Text.ToBinary(ClientID & ":" & Secret), BinaryEncoding.Base64),
Token_Response = Json.Document(Web.Contents(api_url,
[
Headers = [#"Content-Type"="application/x-www-form-urlencoded",#"Authorization"=EncodedCredentials],
Content=Text.ToBinary("grant_type=client_credentials")
]
)
)
Or plain text?
data= Json.Document(Web.Contents(api_url,
[
Headers = [#"Authorization"="Bearer "&token,#"Content-Type"="application/json"]
]
)
)
Regards
Phil
If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.
Anonymous
5 years agoNot applicable
Hi again, thank you! PhilipTreacy
Sorry but I do not know much about APIs, I just followed a guide. I have got one Bearer token. I have entered it like plain text and it works fine until i upload it on Report Server. When Power BI ask me to enter credentials, i choosed anonymous. How can it work locally on my computer but not on report server?
Regards Sophia