'Auth0 & Express-openid-connect /callback not responding
I have a simple node express application running on port 3002 (because 3000 is already used). For logging users in I use Auth0 and the Express-openid-connect package.
Every time I try to log in I get stuck at a blanc page called: Submit This Form, but it doesn't stop loading. The logs in Auth0 always show: successfull login. I can however access non login-protected routes without a problem.
The /callback route throws the following error:
Error: Request aborted
at IncomingMessage.<anonymous> (/workspace/node_modules/formidable/lib/incoming_form.js:122:19)
at IncomingMessage.emit (events.js:400:28)
at abortIncoming (_http_server.js:569:9)
at socketOnEnd (_http_server.js:585:5)
at Socket.emit (events.js:412:35)
at endReadableNT (internal/streams/readable.js:1334:12)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
but I think that's what it is supposed to do when a request is aborted, right?
My Auth0 setup should be right since it doesn't result in an error.
My Express-openid-connect middleware looks linke this:
require('dotenv').config()
const { auth } = require('express-openid-connect')
module.exports = auth({
authRequired: false,
issuerBaseURL: process.env.AUTH0_ISSUER_URL,
baseURL: process.env.BASE_URL,
clientID: process.env.AUTH0_CLIENT_ID,
secret: process.env.AUTH0_SECRET
})
and the env variables:
BASE_URL=http://localhost:3002
AUTH0_ISSUER_URL=...
AUTH0_CLIENT_ID=...
AUTH0_SECRET=H+F/0yW/i4X11EDzAFBZE2iaUTy4jBMo3gBWwXRkoY8W3DJ+E24tnt8Q5y+rF7QO
AUTH0_SECRET is just a random string but I tried it with the client secret provided by Auth0 and it changed nothing.
AUTH0_ISSUER_URL is the correct url since every request shows up in the logs.
AUTH0_CLIENT_ID is the correct client id since the logs show the correct application.
If I manually go to localhost:3002/callback I get the following expected error:
BadRequestError: state missing from the response
at /workspace/node_modules/express-openid-connect/middleware/auth.js:121:31
at processTicksAndRejections (internal/process/task_queues.js:95:5)
This means that my /callback route should be reachable and working.
However I can manually copy the parameters and then everything works however this process isn't usefull for production.
I even tried to submit the form manually over the console
document.forms[0].submit()
but it returned undefined and the page didn't stop loading once again.
So for me there is something wrong with the submit() function of that form.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
