cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

oAuth and Power Query

I need to connect to external web API. This API uses a custom oAuth 2.0 verification process.

Now I would need to do the exact same steps using power query (M)/ Power BI.

 

I have managed successfully connect to web API using Postman so I can so you example what that looks like.

curl -X POST \ 'https://api-test.XXX.com/api/oauth/authz?response_type=code&client_id=TestClient&state=100&username=test&password=XXX&company=12345&redirect_uri=redirect-uri-placeholder' \
-H 'Content-Type: application/x-www-form-urlencoded' \

In Power Query I used following code

let
    Source = Value.Metadata(Web.Contents("https://api-test.XXX.com/api/oauth/authz?response_type=code&client_id=TestClient&state=100&username=test&password=XXX&company=12345&redirect_uri=redirect-uri-placeholder", [Headers=[#"Content-Type"="application/x-www-form-urlencoded"]]))
in
    Source

This gives me Response.Status 405 error.

 

In order to get this to work in Postman I had to disable "Automatically follow redirects". Is there a similiar problem with Power Query?

 

1 REPLY 1
Highlighted
Super User IV
Super User IV

Re: oAuth and Power Query

I don't know if that option exists in M. You could always also try R.


---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors