# OPError: expected 200 OK, got: 302 Found, using express-openid-connect

**URL:** <https://community.auth0.com/t/operror-expected-200-ok-got-302-found-using-express-openid-connect/62636>\
**Category:** Get Help\
**Tags:** auth0\
**Created:** [May 12, 2021, 2:52am UTC](https://community.auth0.com/t/operror-expected-200-ok-got-302-found-using-express-openid-connect/62636 "2021-05-12T02:52:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![naddeo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/naddeo/32/25922_2.png) [@naddeo](https://community.auth0.com/u/naddeo)\
**Post date:** [May 12, 2021, 2:52am UTC](https://community.auth0.com/t/operror-expected-200-ok-got-302-found-using-express-openid-connect/62636/1 "2021-05-12T02:52:38Z")

</div>

I’m attempting to upgrade an express node app that I have from express-openid-connect@1.0.2 and auth0@2.31.0 to the most recent versions and I’m running into a lot of issues. It’s a bit complicated because I’m attempting to follow some modern auth0 guides but I’m updating an app that I didn’t set up so I apologize if I leave something out.

So far, I’ve done:

The most recent issue I’m having when I attempt to access my express server’s `/login` route is:

```auto
(node:62030) UnhandledPromiseRejectionWarning: AggregateError: Issuer.discover() failed.
    OPError: expected 200 OK, got: 302 Found
    OPError: expected 200 OK, got: 302 Found
    at Function.discover (/Users/anthony/workspace/my-service/node_modules/openid-client/lib/issuer.js:265:17)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

```

It’s a pretty cryptic error and I’ve got no idea what’s wrong. I don’t know why I’m getting a 302. The error is [here](https://github.com/panva/node-openid-client/blob/main/lib/issuer.js#L265) in openid-client. It’s attempting to call two "wellknown url"s

- [https://my-app.us.auth0.com/.well-known/openid-configuration](https://my-app.us.auth0.com/.well-known/openid-configuration)
- [https://my-app.us.auth0.com/.well-known/oauth-authorization-server](https://my-app.us.auth0.com/.well-known/oauth-authorization-server)

But that’s really all the information I can get out of it. If it matters, I’m running my express server on 8080 and I’m accessing it via a browser at `https://localhost/login`, and I’m proxying 443 → 8080 via caddy.

---

<div class="post-metadata">

**Author:** ![naddeo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/naddeo/32/25922_2.png) [@naddeo](https://community.auth0.com/u/naddeo)\
**Post date:** [May 12, 2021, 3:28am UTC](https://community.auth0.com/t/operror-expected-200-ok-got-302-found-using-express-openid-connect/62636/2 "2021-05-12T03:28:42Z")

</div>

Looks like this was the solution: [Authorization code flow results in "connect ECONNREFUSED 127.0.0.1:443" · Issue #158 · auth0/express-openid-connect · GitHub](https://github.com/auth0/express-openid-connect/issues/158#issuecomment-839402660)

Adding the following to my package.json to resolve some conflict in dependencies. This was a very painful bug.

```auto
 "resolutions": {
    "agent-base": "^6.0.1"
  },

```

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [May 12, 2021, 12:06pm UTC](https://community.auth0.com/t/operror-expected-200-ok-got-302-found-using-express-openid-connect/62636/3 "2021-05-12T12:06:49Z")

</div>

Thanks for sharing that with the rest of community!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [May 27, 2021, 11:53am UTC](https://community.auth0.com/t/operror-expected-200-ok-got-302-found-using-express-openid-connect/62636/4 "2021-05-27T11:53:27Z")

</div>


