Login callback error: 'access_denied (Invalid API Key provided: sk_....)'

I’m following the Node.js Express quick start guide.

I’ve integrated the SDK with the following:

.
.
.
import openidConnect from 'express-openid-connect'

const app = express()

const { auth } = openidConnect

const config = {
    authRequired: false,
    auth0Logout: true,
    secret: mySecret,
    baseURL: 'http://localhost:3000',
    clientID: myClientID,
    issuerBaseURL: 'https://olive-press.us.auth0.com'
}

app.use(cors())

app.use(auth(config))
.
.
.

Going to http://localhost:3000/login correctly routes me to the login page on https://olive-press.us.auth0.com but after I log in I get the following error when routed back to http://localhost:3000/callback:

BadRequestError: access_denied (Invalid API Key provided: sk_....)
    at path/to/project/node_modules/express-openid-connect/middleware/auth.js:105:31
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

I can’t find a similar error in any other community post or Google so I’m guessing it’s something unique to my setup.

After much knocking my head against the way I’ve solved it.

The error was being thrown by one of the rules I had set up, which contained an invalid API key…

1 Like

No worries! We’ve all been there!