# Authorization Code Flow : validating JWT Token, nonce required

**URL:** <https://devforum.okta.com/t/authorization-code-flow-validating-jwt-token-nonce-required/13932>\
**Category:** Questions\
**Created:** [April 22, 2021, 10:14pm UTC](https://devforum.okta.com/t/authorization-code-flow-validating-jwt-token-nonce-required/13932 "2021-04-22T22:14:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![kblizeck](https://avatars.discourse-cdn.com/v4/letter/k/58f4c7/32.png) [@kblizeck](https://devforum.okta.com/u/kblizeck)\
**Post date:** [April 22, 2021, 10:14pm UTC](https://devforum.okta.com/t/authorization-code-flow-validating-jwt-token-nonce-required/13932/1 "2021-04-22T22:14:59Z")

</div>

I’m using the Authorization Code Flow with the [Okta Sign in Widget](https://developer.okta.com/code/javascript/okta_sign-in_widget/).

Receiving a `code` back from a successful login, then hitting the `/token` endpoint to swap that `code` for an `id_token` that contains user profile claims that I need for my app.

I’m trying to [validate my JWT id\_token](https://developer.okta.com/docs/guides/validate-access-tokens/php/overview/), but it’s erroring with `Nonce does not match what is expected. Make sure to provide the nonce with `setNonce()` from the JwtVerifierBuilder.`

I’ve tried `setNonce(null)`, but it still yells at me.

What can I do? How can I get the nonce value from the authorization code flow, in order to validate an id\_token?

---

<div class="post-metadata">

**Author:** ![Lijia](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/lijia/32/2295_2.png) [@Lijia](https://devforum.okta.com/u/Lijia)\
**Post date:** [April 23, 2021, 3:52am UTC](https://devforum.okta.com/t/authorization-code-flow-validating-jwt-token-nonce-required/13932/2 "2021-04-23T03:52:16Z")

</div>

@kblizeck Hi, if you are not using a nonce, you can use the `setNonce(null)` method to skip nonce validation. Not sure what error you received after that, but you can check if this [solution](https://github.com/okta/okta-jwt-verifier-php/issues/63#issuecomment-730459110) works for you.

---

<div class="post-metadata">

**Author:** ![kblizeck](https://avatars.discourse-cdn.com/v4/letter/k/58f4c7/32.png) [@kblizeck](https://devforum.okta.com/u/kblizeck)\
**Post date:** [April 23, 2021, 4:09am UTC](https://devforum.okta.com/t/authorization-code-flow-validating-jwt-token-nonce-required/13932/3 "2021-04-23T04:09:36Z")

</div>

I was receiving the same Nonce error I included in my original message when sending setNonce(null), that the Nonce didn’t match.

---

<div class="post-metadata">

**Author:** ![Lijia](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/lijia/32/2295_2.png) [@Lijia](https://devforum.okta.com/u/Lijia)\
**Post date:** [April 23, 2021, 3:39pm UTC](https://devforum.okta.com/t/authorization-code-flow-validating-jwt-token-nonce-required/13932/4 "2021-04-23T15:39:40Z")

</div>

@kblizeck Can you please check the link of the solution (overrode the decode function) I attached? If that does not work for you, please open a support ticket through an email to [support@okta.com](mailto:support@okta.com) with this issue? One of our Dev Support Engineers will take the case and assist you in narrowing down the cause of the issue. Thanks

---

<div class="post-metadata">

**Author:** ![kblizeck](https://avatars.discourse-cdn.com/v4/letter/k/58f4c7/32.png) [@kblizeck](https://devforum.okta.com/u/kblizeck)\
**Post date:** [April 28, 2021, 4:24pm UTC](https://devforum.okta.com/t/authorization-code-flow-validating-jwt-token-nonce-required/13932/5 "2021-04-28T16:24:35Z")

</div>

I opened a support ticket, and was able to get this resolved!

---

<div class="post-metadata">

**Author:** ![Lijia](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/lijia/32/2295_2.png) [@Lijia](https://devforum.okta.com/u/Lijia)\
**Post date:** [April 28, 2021, 5:29pm UTC](https://devforum.okta.com/t/authorization-code-flow-validating-jwt-token-nonce-required/13932/6 "2021-04-28T17:29:16Z")

</div>

Great to know. Thanks for the update. This topic is closed.

---

<div class="post-metadata">

**Author:** ![Lijia](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/lijia/32/2295_2.png) [@Lijia](https://devforum.okta.com/u/Lijia)\
**Post date:** [April 28, 2021, 5:29pm UTC](https://devforum.okta.com/t/authorization-code-flow-validating-jwt-token-nonce-required/13932/7 "2021-04-28T17:29:26Z")

</div>

Closed on April 28, 2021, 5:29pm UTC


