Azure-Samples / ms-identity-python-webapp

A Python web application calling Microsoft graph that is secured using the Microsoft identity platform
MIT License
284 stars 135 forks source link

Trouble signing in to Microsoft account #41

Closed sampanayak closed 3 years ago

sampanayak commented 3 years ago

Hello,

I followed all the steps here, the application is running but while trying to sign in for authentication I am getting below error. Can anybody help?

Sign in Sorry, but we’re having trouble signing you in.

AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application: 'c0e8bfbd-8c48-4645-86eb-c3cb1c65ebfd'.

Troubleshooting details If you contact your administrator, send this info to them. Copy info to clipboard Request Id: 661b5835-c759-4879-85cb-7fa699cf1900 Correlation Id: 655cdc53-4346-4747-a401-db22da318bcd Timestamp: 2020-08-06T16:07:46Z Message: AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application: 'c0e8bfbd-8c48-4645-86eb-c3cb1c65ebfd'.

rayluo commented 3 years ago

So, what is the reply URL you configured in Azure portal and inside this sample? Can you share them here? Do they match?

sampanayak commented 3 years ago

I just followed the documentation, as it says http://localhost:5000/getAToken I mentioned in azure but I have not checked it on sample code.

rayluo commented 3 years ago

Note that in our README, here, it mentions:

$ flask run --host localhost --port 5000

If you skip that part, Flask will serve on http://127.0.0.1:5000 instead, which won't match http://localhost:5000/....

sampanayak commented 3 years ago

So what should I change now? please suggest.

rayluo commented 3 years ago

Stop flask, re-run it, using the way our README documents.

sampanayak commented 3 years ago

Re-run the flask by flask run --host localhost --port 5000, still has the same issue

rayluo commented 3 years ago

Each time when you run Flask, it will print something similar to this on the console:

Running on http://localhost:5000/ (Press CTRL+C to quit)

Then you can click that link. This would ensure you are using the right host (i.e. localhost rather than 127.0.0.1). If you were still re-using your same browser window which was using 127.0.0.1, abandon that tab and start afresh.

PS: If that does not solve the issue, it would be a different issue than such "localhost vs 127.0.0.1 FAQ", then we would be back to square 1, and you would need to really check and compare your app's local setting and its settings in azure portal.

sampanayak commented 3 years ago

Thank you!