# Express-openid-connect response\_type: code = 400 access\_denied

**URL:** <https://community.auth0.com/t/express-openid-connect-response-type-code-400-access-denied/85122>\
**Category:** Get Help\
**Created:** [June 15, 2022, 2:23am UTC](https://community.auth0.com/t/express-openid-connect-response-type-code-400-access-denied/85122 "2022-06-15T02:23:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bitsofinfo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bitsofinfo/32/38026_2.png) [@bitsofinfo](https://community.auth0.com/u/bitsofinfo)\
**Post date:** [June 15, 2022, 2:23am UTC](https://community.auth0.com/t/express-openid-connect-response-type-code-400-access-denied/85122/1 "2022-06-15T02:23:59Z")

</div>

I’m using the nodejs express sample app generated that uses: [GitHub - auth0/express-openid-connect: An Express.js middleware to protect OpenID Connect web applications.](https://github.com/auth0/express-openid-connect)

1. I have a regular web application in auth0
2. I downloaded the sample app, and it works out of the box fine
3. My app needs to get an accessToken so I followed the directions about `response_type: code` in the `auth` config (below)
4. Now after successful login, and consent the redirect fails at `/callback` with a 400 and `access_denied`
5. auth0 logs show a `Failed Exchange` error of `Unauthorized`
6. the app’s token endpoint auth method is POST

I’m not sure what to do here or what the issue is.

```auto
const config = {
  authRequired: false,
  auth0Logout: true,
  clientSecret: process.env.SECRET,
  authorizationParams: {
    response_type: 'code',
    scope: 'openid profile email read:whatever',
    audience: 'https://my-email-test-service',
    prompt: 'consent'
  } 
};

```

The 400 unauthorized is displayed on this uri

```auto
http://localhost:3000/callback?code=SditZiRrQswFl1bLW8veGnwsveNbxIxxxxxxxx&state=eyJyZXR1cxxxxxxxxJ9`

```

---

<div class="post-metadata">

**Author:** ![bitsofinfo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bitsofinfo/32/38026_2.png) [@bitsofinfo](https://community.auth0.com/u/bitsofinfo)\
**Post date:** [June 15, 2022, 4:40pm UTC](https://community.auth0.com/t/express-openid-connect-response-type-code-400-access-denied/85122/2 "2022-06-15T16:40:08Z")

</div>

fixed this by ensuring that `clientSecret` is the CLIENT\_SECRET… not the rando SECRET value that the app generates in the sample app

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 22, 2024, 6:53pm UTC](https://community.auth0.com/t/express-openid-connect-response-type-code-400-access-denied/85122/3 "2024-11-22T18:53:54Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
