cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
franckster Frequent Visitor
Frequent Visitor

Azure AD oAuth request returns html page and not oAuth Code

Hi all,

 

I'm new to PBI and the AAD world, presently working on an Embedded App Owns Data POC for our company, to display custom dashboard for our clients within our application.

I've followed all the step to declare a PowerBI Native App and grant permissions in our Azure Active Directory tenant, got a client id, the oAuth API endpoint. I declared urn:ietf:wgSmiley Surprisedauth:2.0Smiley Surprisedob as a return url for now.

Since we developped our app in Ruby on Rails, I'm test riding the API with raw calls with the Restlet Client Chrome extension.

I'm following the instructions there : https://docs.microsoft.com/en-US/azure/active-directory/develop/active-directory-protocols-oauth-cod...

I am stuck on the first step. When I call POST on this url :

https://login.microsoftonline.com/"mytenantid"/oauth2/authorize?client_id="myclientid"&response_type...

I don't get a response with an AD access code but an html page that basically says "Connect to your application".

Any help will be greatly appreciated...

Thanks forward !

 

1 ACCEPTED SOLUTION

Accepted Solutions
franckster Frequent Visitor
Frequent Visitor

Re: Azure AD oAuth request returns html page and not oAuth Code

Replying to myself but will be useful for others too seeing the time I spent on the matter...

MS Support pointed me to this thread which solved my problem :

https://community.powerbi.com/t5/Developer/How-To-Get-embed-token-using-Get-Post-only/td-p/294475

I used Postman to try everything, making sure to pass the body of the Get Embed Token API POST calls as Raw / JSON (application/json) ( cf radio buttons underneath the Authorization/Headers/Body/Pre-request Script/Test tabs). Doing otherwise would set this particular API calls off for passing form-data.

Hope this helps !

Thanks again @v-ljerr-msft for your help !

View solution in original post

4 REPLIES 4
v-ljerr-msft Super Contributor
Super Contributor

Re: Azure AD oAuth request returns html page and not oAuth Code

Hi @franckster,

 

Instead of using the Restlet Client Chrome extension, could you try using POSTMAN which is recommended for testing/debug purpose. For more details, you can refer to this similar thread. Smiley Happy

 

Capture.PNG

 

Regards

franckster Frequent Visitor
Frequent Visitor

Re: Azure AD oAuth request returns html page and not oAuth Code

Thanks a lot for reaching out !

I had a PBI Support engineer on the phone Friday and we managed to get a report embedded using the .NET App Owns Data Project on Github.

The trouble was that you need to pass Client credentials to get the AD oAuth Access Token in the first place even for an App Owns Data scenario. And even though I read the doc a few dozen times, I never came across it.

Adam Saxton indeed mentions the "Master account" in one of his videos and the code does create variables for a username & password to be passed to AD.

We couldn't find it in the API doc when we looked up for the raw API call url nor in the App Owns Data source code either.

The engineer said he would get in touch with the folks over in Redmond and email me went the answer came.

I'll post it back here once I have it !

franckster Frequent Visitor
Frequent Visitor

Re: Azure AD oAuth request returns html page and not oAuth Code

Replying to myself but will be useful for others too seeing the time I spent on the matter...

MS Support pointed me to this thread which solved my problem :

https://community.powerbi.com/t5/Developer/How-To-Get-embed-token-using-Get-Post-only/td-p/294475

I used Postman to try everything, making sure to pass the body of the Get Embed Token API POST calls as Raw / JSON (application/json) ( cf radio buttons underneath the Authorization/Headers/Body/Pre-request Script/Test tabs). Doing otherwise would set this particular API calls off for passing form-data.

Hope this helps !

Thanks again @v-ljerr-msft for your help !

View solution in original post

Highlighted
d_u_a Regular Visitor
Regular Visitor

Re: Azure AD oAuth request returns html page and not oAuth Code

@v-ljerr-msft
When i try to get Embed Token by sending Access Token i'm taking 403 Forbidden (step 3).  I'm sending data as raw and application/json .
Could you recommend something to me fix this problem ?

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 33 members 873 guests
Please welcome our newest community members: