502 Bad Gateway nginx/1.22.1 Error When Accessing Login Link

Problem statement

I deploying my app to AWS and am having trouble with the authentication. Authentication worked great when I was developing locally, but it’s not working anymore after deploying it.

I’m receiving a "502 Bad Gateway nginx/1.22.1" error. I can access my other API routes through my website, but the only one not working is the login route which goes through Auth0.

This is my login route:

@app.route("/api/login")
def login():
  return oauth.auth0.authorize_redirect(redirect_uri="[https://myexampleapp.com/api/callback"](https://myexampleapp.com/api/callback)")

My “/api/callback” route gets the Auth0 and Twitter access token then redirects Auth0 to a webpage in my app.

Do you have an idea what might be going wrong?

Solution

In this situation, we recommend working with AWS to open up the 443 port to resolve this issue.