E_FreeLancer
E_FreeLancer

Reputation: 91

Incorrect redirect URL address while working with Microsoft Graph API

I am working on Microsoft graph API for implementing the Email functionality.

I suppose to get below url as mentioned in the steps.

https://login.microsoftonline.com/common/oauth2/nativeclient?code={IAQABAAIAAABHh4kmS_aKT5XrjzxRAtHz5S...p7OoAFPmGPqIq-1_bMCAA}&session_state=dd64ce71-4424-494b-8818-be9a99ca0798

instead of that I am getting below url

https://login.microsoftonline.com/a1f1e214-xxxx-xxxx-xxxxxx-xxxxxxxx59641/oauth2/v2.0/authorize?response_type=code&client_id=xxxxxxx-1xxxx-xxxx-ad2a-d80d3f51638a&redirect_uri=https%3A%2F%2Flogin.microsoftonline.com%2Fcommon%2Foauth2%2Fnativeclient&scope=Files.ReadWrite%20openid%20User.Read%20Mail.Send%20Mail.ReadWrite

Note: The Above step is highligted in the documentation

Is this because I dont have check the box checked next to oauth2/nativeclient which is mention at Step 4 Point 8 in the documentation.

Any guidance will be great help

Upvotes: 2

Views: 2525

Answers (1)

Tony Ju
Tony Ju

Reputation: 15609

The command line interface opens a browser window on the Azure Active Directory authorization endpoint. Enter your user name and password to authenticate. When you are authenticated, you're taken to an authorization window for the sample app. Review and accept the scopes requested by the sample app. Click the Ok button on the authorization window.

When you got that url, you should be asked to login. After that, you will get the code.

The steps:

Register an app on Azure portal->get the client id-> go to Constants.java class and replace the client_id with yours.

enter image description here

Run the PublicClient class.

enter image description here

Login in with your account, then you will get the code.

enter image description here

Upvotes: 1

Related Questions