I keep getting Invalid redirect_uri when using oAuth

When I’m processing an OAuth login authorization with Monday, I’m encountering the following error:

{"error":"invalid_request","error_description":"Invalid redirect_uri"}

This is the authorization function I’m using to handle the auth process:

@app.route("/auth")
def authorization():
    token = request.args.get('token')
    auth_params = {
        'client_id': CLIENT_ID,
        'state': token,
        'redirect_uri': REDIRECT_URI
    }
    
    logger.warning(f"Authorization params: {auth_params}")
    auth_url = 'https://auth.monday.com/oauth2/authorize?' + urlencode(auth_params)
    logger.warning(f"Authorization full url: {auth_url}")
    return redirect(auth_url)

The CLIENT_ID is correct, and the token is what I’m getting from Monday.
The REDIRECT_URI is the callback URL to be used after the auth process finishes.

What could be causing the “Invalid redirect_uri” error, and how can I fix it?

Hello there @omerbsh and welcome to the community!

Would you be able to please fill this form adding as much information as possible to it (such as account ID, app ID, timestamps, etc.) so that our team can take a look into it?