Spotify's API returns authorisation code generated after user's verification in the following format:
<customer_callback_URL>?code=1234567
To capture the code in my Flask app, I've created a dynamic URL:
@app.route("/<auth_code>")
def callback_code(auth_code):
return auth_code
Unfortunately, after receiving correct callback, the URL in the browser's address bar looks like this: http://127.0.0.1:5000/?code=1234567
Unfortunately, the dynamic URL ending ?code=1234567 is not generated and Flask server generates 404 error.
This is due to parameters (preceded by "?") are present in the callback URI. That makes the callback_code function unable to return the ?code=1234567 function of the URI.
How can I capture either the callback code string or callback's parameters, so that I can use the authorisation code in the other parts of my Flask app?