Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

How to connect to an OData source using a token

Hi all,

 

I need to pass a token to access an external OData api - how can this be achieved? 

 

Thanks!

Keith. 

2 Replies

  • dax's avatar
    dax
    Icon for Community Support rankCommunity Support

    Hi Anonymous , 

    You could use token in Basic authentiocation, you could refer to odata-with-power-bi  for details. Or you also could try below M code(use anonymous) to see whether it work or not

    let 
    Source = OData.Feed("myOdataURL", null, [Headers = [Authorization = "My token" ] ])
    in
    Source

    Best Regards,
    Zoe Zhi

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Zoe,

       

      Thanks for your reply. Using basic just didn't work.  Tried PowerQuery using your suggested solution ...  = OData.Feed("https://localhost:44399/odata/", null, [Headers = [Authorization = "bearer xxxxxxxxx" ] ]) No luck at all I just get a "Edit Credentials" dialog 😞

       

      Nothing wrong on the api side - as all is working fine through Postman. All works ok in PowerBI too once I temporarily disable auth on the api.

       

      Thanks, Keith.