Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

Power BI Can't Authenticate with Anonymous type

Hi, everyone.

 

Hope all is well 🙂

 

I'm trying to get the Bearer token using web.contents in Power Query, in PowerBI.

But it keeps popping up that I need to login anonymously - and it always fails when I try to:

 

 

I've tested multiple things and can't seem to get this to work (tried using the relative path, invoking this as a custom function, playing around with the headers).

 

let
url = "https://test.eu/",
#"Client Id" = "cid",
#"Client Secret" = "csecret",

authorizeBody = "{ ""client_id"": """ & #"Client Id" & """,
""client_secret"": """ & #"Client Secret" & """,
""grant_type"": ""client_credentials""
}",
authorizeResponse = Json.Document(Web.Contents(url,[Headers = [#"Content-Type"="application/x-www-form-urlencoded"], RelativePath="/oauth/token", Content = Text.ToBinary(authorizeBody)] )),
AccessToken = authorizeResponse[access_token]
in
AccessToken

It's working properly with postman and on python.

 

Any ideas what it could be?

 

Thanks a lot!

3 Replies

  • Anonymous 

    Have you eneabled the Anonymous connection as follows:

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Unfortunetaly, not working with anonymous in the Global Permissions 😞

    • Anonymous's avatar
      Anonymous
      Not applicable

      any other ideas? thank you!