# Error while validating token using jwt verifier

**URL:** <https://devforum.okta.com/t/error-while-validating-token-using-jwt-verifier/7241>\
**Category:** Questions\
**Created:** [December 9, 2019, 9:51am UTC](https://devforum.okta.com/t/error-while-validating-token-using-jwt-verifier/7241 "2019-12-09T09:51:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MDD](https://avatars.discourse-cdn.com/v4/letter/m/43a26b/32.png) [@MDD](https://devforum.okta.com/u/MDD)\
**Post date:** [December 9, 2019, 9:51am UTC](https://devforum.okta.com/t/error-while-validating-token-using-jwt-verifier/7241/1 "2019-12-09T09:51:42Z")

</div>

Hi,

I am trying to validate my access token using okta jwt verified , by referring to the link [https://github.com/okta/okta-jwt-verifier-java](https://github.com/okta/okta-jwt-verifier-java)

But getting the below error.(Issuer I am using is https://\<OKTA\_URL\>/oauth2/default/v1/authorize)

Caused by: io.jsonwebtoken.JwtException: Failed to fetch keys from URL: https:/oauth2/default/v1/keys  
at com.okta.jwt.impl.jjwt.RemoteJwkSigningKeyResolver.updateKeys(RemoteJwkSigningKeyResolver.java:101)  
at com.okta.jwt.impl.jjwt.RemoteJwkSigningKeyResolver.getKey(RemoteJwkSigningKeyResolver.java:70)  
at com.okta.jwt.impl.jjwt.RemoteJwkSigningKeyResolver.resolveSigningKey(RemoteJwkSigningKeyResolver.java:55)  
at io.jsonwebtoken.impl.DefaultJwtParser.parse(DefaultJwtParser.java:342)  
at io.jsonwebtoken.impl.DefaultJwtParser.parse(DefaultJwtParser.java:513)

Any help is much appreciated.

Thanks

---

<div class="post-metadata">

**Author:** ![dragos](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/dragos/32/1313_2.png) [@dragos](https://devforum.okta.com/u/dragos)\
**Post date:** [December 10, 2019, 1:38am UTC](https://devforum.okta.com/t/error-while-validating-token-using-jwt-verifier/7241/2 "2019-12-10T01:38:59Z")

</div>

Hi @MDD

Can you please switch the issuer to `https://<OKTA_URL>/oauth2/default` from `https://<OKTA_URL>/oauth2/default/v1/authorize` and try once again?

---

<div class="post-metadata">

**Author:** ![MDD](https://avatars.discourse-cdn.com/v4/letter/m/43a26b/32.png) [@MDD](https://devforum.okta.com/u/MDD)\
**Post date:** [December 12, 2019, 7:01am UTC](https://devforum.okta.com/t/error-while-validating-token-using-jwt-verifier/7241/3 "2019-12-12T07:01:39Z")

</div>

Hi Dragos,

Thanks for your response and changing the issuer URL fixed the issue.

Thanks

---

<div class="post-metadata">

**Author:** ![MDD](https://avatars.discourse-cdn.com/v4/letter/m/43a26b/32.png) [@MDD](https://devforum.okta.com/u/MDD)\
**Post date:** [December 12, 2019, 4:23pm UTC](https://devforum.okta.com/t/error-while-validating-token-using-jwt-verifier/7241/4 "2019-12-12T16:23:38Z")

</div>

Hi Dragos,

I think I might need your help again on this.Our requirement is to generate an access token which will be used to invoke a API call (for example - listusers).To achieve this the scope should be “okta.users.read” . I tried generating access token with different ways but the JWT Validator is always failing.

For JWT Validator,I am using the below configuration  
String issuerUrl = “https://\<OKTA\_URL\>/oauth2/default”;  
String audience = “api://default”;

Option 1 : Tried generating access token with “default” in the URL  
https://\<OKTA\_URL\>/oauth2/default/v1/authorize?client\_id=\<CLIENT\_ID\>&response\_type=token&response\_mode=fragment&  
scope=okta.users.read&redirect\_uri=\<REDIRECT\_URI\>/&nonce=UBGW&state=1234

Output - http://\<REDIRECT\_URI\>/#state=1234&error=invalid\_scope&error\_description=One+or+more+scopes+are+not+configured+for+the+authorization+server+resource.

Option 2: Generated access token without “default” in the URL  
https://\<OKTA\_URL\>/oauth2/v1/authorize?client\_id=\<CLIENT\_ID\>&response\_type=token&response\_mode=fragment&  
scope=okta.users.read&redirect\_uri=\<REDIRECT\_URI\>/&nonce=UBGW&state=1234

Output - JWT error - A signing key must be specified if the specified JWT is digitally signed.

Option 3 - Using the [https://oauthdebugger.com/](https://oauthdebugger.com/) site,I am able to generate an access token,which is getting validated by JWT validator but this site doesnt support okta.users.read scope.

Let me know if you have any thoughts/suggestions.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![dragos](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/dragos/32/1313_2.png) [@dragos](https://devforum.okta.com/u/dragos)\
**Post date:** [December 13, 2019, 3:11am UTC](https://devforum.okta.com/t/error-while-validating-token-using-jwt-verifier/7241/5 "2019-12-13T03:11:13Z")

</div>

Hi @MDD

I’ve checked on my end and, indeed, OAuth for Okta scopes can only be requested at the moment from Okta authorization server (eg. /oauth2/v1/authorize), meaning that the only way to verify this tokens is by doing an introspect and check if the token is returned as active or not.

---

<div class="post-metadata">

**Author:** ![Shubham6541](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@Shubham6541](https://devforum.okta.com/u/Shubham6541)\
**Post date:** [April 5, 2020, 1:36pm UTC](https://devforum.okta.com/t/error-while-validating-token-using-jwt-verifier/7241/6 "2020-04-05T13:36:12Z")

</div>

@dragos how can i use introspect call in postman for okta org authorization server?  
It is silly question but please help.  
Thank you

---

<div class="post-metadata">

**Author:** ![dragos](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/dragos/32/1313_2.png) [@dragos](https://devforum.okta.com/u/dragos)\
**Post date:** [April 6, 2020, 2:15am UTC](https://devforum.okta.com/t/error-while-validating-token-using-jwt-verifier/7241/7 "2020-04-06T02:15:34Z")

</div>

Hi @Shubham6541

You can use the same call basically as for the custom authorization servers:

```auto
curl --location --request POST 'https://dragos.okta.com/oauth2/v1/introspect' \
--header 'Accept: application/json' \
--header 'Authorization: Basic MG9hN...' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'token=TOKEN_HERE'

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [January 24, 2024, 7:07pm UTC](https://devforum.okta.com/t/error-while-validating-token-using-jwt-verifier/7241/8 "2024-01-24T19:07:27Z")

</div>

Closed on January 24, 2024, 7:07pm UTC

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