Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question: localhost vs 127.0.0.1 redirect URI #104

Open
pawelofficial opened this issue May 3, 2023 · 6 comments
Open

question: localhost vs 127.0.0.1 redirect URI #104

pawelofficial opened this issue May 3, 2023 · 6 comments
Labels
question Further information is requested

Comments

@pawelofficial
Copy link

hi, this is my first time opening an issue so i apologize in advance for it's quality. Nevertheless i am following
https://learn.microsoft.com/en-us/azure/active-directory-b2c/configure-authentication-sample-python-web-app
tutorial and my redirect URI didn't match in step 5.4, exact message from flask:
GET /getAToken.?error=redirect_uri_mismatch&error_description=AADB2C90006:+The+redirect+URI+'http://127.0.0.1:5000/getAToken'+provided+in+the+request+is+not+registered+for+the+client+id+'xxx-xx-xx-xx-xx'.%0d%0aCorrelation+ID:+xxx-xxx-xxx-xx-xxx%0d%0aTimestamp:+2023-05-03+10:03:02Z%0d%0a&state=jsaKCDnFuqMGzkrL

and when i hardcoded the redirect_uri in login route to "http://localhost:5000/getAToken."
it worked.

@pawelofficial
Copy link
Author

as pointed out 5 years ago here
https://stackoverflow.com/questions/41581369/microsoft-application-redirect-uri-allows-localhost-but-not-127-0-0-1
one can change redirect url via manifest on Azure site to allow for http://127.0.0.1 which fixes the issue

@rayluo rayluo added the question Further information is requested label May 4, 2023
@rayluo
Copy link
Contributor

rayluo commented May 4, 2023

You seemed to be going through the hard route to enable 127.0.0.1 which was not allowed in Azure Portal.

I believe you can try following our README, which references to a Quickstart guide, whose last step tells you to run your flask server with a --host=localhost parameter, that way you would probably not run into this 127.0.0.1 issue at all. Please test and let us know.

@Jaya-sys
Copy link

Or you can pass the value in app.run(localhost="locahost") and can give the uri path in the azure directory

@rayluo
Copy link
Contributor

rayluo commented Jul 25, 2023

Or you can pass the value in app.run(localhost="locahost") and can give the uri path in the azure directory

Did you mean to say app.run(host="...")? I see no localhost parameter in Flask.run()'s docs.

Regardless, this sample itself does not intend to hardcode for localhost, because we do not want to support localhost-only. If anything, we just want to discourage 127.0.0.1.

@pawelofficial
Copy link
Author

i did, sorry

@rayluo
Copy link
Contributor

rayluo commented Jul 28, 2023

i did, sorry

That is OK. You are welcome. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants