2

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

  • The source code is referred from the official microsoftgraph github account.
  • I am following the step mentioned here
  • On this Step I supposed to get a code in redirect URL address.

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

11
  • Redirect Uri should be same as that you have specified on azure portal Commented Jul 31, 2019 at 12:30
  • yes I have tried that. But I am not getting any access code I have mention in my question Commented Jul 31, 2019 at 12:38
  • Any update for this issue? Commented Aug 1, 2019 at 14:45
  • @CaiyiJu : I am still not getting the url that you have mention in your answer (The url wich contains the code) instead the URL which I am getting contains code&client_id=. Commented Aug 2, 2019 at 5:40
  • @E_FreeLancer Have you entered your user name and password to authenticate? Commented Aug 2, 2019 at 5:42

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.