问题
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
回答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.
Run the PublicClient class.
Login in with your account, then you will get the code.
来源:https://stackoverflow.com/questions/57290670/incorrect-redirect-url-address-while-working-with-microsoft-graph-api