How to prevent Flask redirecting to the default port of 5000?
Check config.py
file, you have a route there with 5000 port
Related videos on Youtube
Emre Sevinç
Co-founder & CTO @ TM Data ICT Solutions: helping our clients with data strategy & implementation, enabled by Machine Learning, Data Science & Analytics, AI, Cloud Computing, data engineering, and data quality. For more details, see LinkedIn, GitHub, Twitter, and my blog. I started programming on 8-bit computers in 1980s, and I've been using GNU/Linux since 1994. I've been getting things done in Python, Bash, Java, AWS, Azure, Hadoop, Spark, Common Lisp, Emacs Lisp, etc. I'm also interested in Haskell & Idris. Academic background: mathematics, engineering, and cognitive science.
Updated on June 04, 2022Comments
-
Emre Sevinç almost 2 years
I'm trying to run a Python sample for using Microsoft Graph. It uses Flask libraries for a mini-application that can be run using the Flask's standalone web server.
I've modified the application initialization line as
APP.run(port=9999)
And it starts running successfully at
http://localhost:9999/
, but then after a step, it redirects tohttp://localhost:5000
which is problematic.If I change the initial part of the URL in my browser to
http://localhost:9999
and hit ENTER, it continues to function as expected.How can tell Flask to "redirect to the URL with the port number I declared in APP.run"?
-
Vivek Kalyanarangan about 6 yearsthats weird. Can you show the initialization of the APP object? Also how are you running it?
-
Emre Sevinç about 6 yearsEverything is done in this single file: github.com/microsoftgraph/python-sample-send-mail/blob/master/…
-
Sudheesh Singanamalla about 6 yearsAfter authentication where does the redirect callback return on the flask app? Did you configure graph to redirect on success to
localhost:5000/login/authorized
instead of:9999/login/authorized
? -
Emre Sevinç about 6 yearsSo, this should be configured on Microsoft Graph side? Not only a Pyhton code configuration issue you mean?
-
Sudheesh Singanamalla about 6 yearsYou need to configure the
REDIRECT_URI
on python side and on the Microsoft Graph settings for your application -
Emre Sevinç about 6 yearsIndeed! One more thing learned about Microsoft Graph API :) Thanks!
-
Emre Sevinç about 6 yearsWhat's that with 3 Close Votes? This is certainly about programming. I'm referring to some Python code, and the answers include a change to that Python code, together with other changes in the comments. Why this is marked as off-topic, is a mystery to me! :(
-
-
Emre Sevinç about 6 yearsChanged that to 9999 and then I got from Microsoft side: "Sign in Sorry, but we’re having trouble signing you in. AADSTS50011: The reply address 'localhost:9999/login/authorized' does not match the reply addresses configured for the application: '9eea536f-ccdf-4472-94d8-7ca6acfea142'. More details: not specified"
-
akrn about 6 yearsYou should configure your Microsoft Graph app to allow new redirect URL
-
Emre Sevinç about 6 yearsOK, I had to go to apps.dev.microsoft.com/#/application and change Redirect URLs to localhost:9999/login/authorized . I'll accept your answer.