# Validating Auth0 Token - Spring Security

**URL:** <https://community.auth0.com/t/validating-auth0-token-spring-security/72569>\
**Category:** Get Help\
**Tags:** jwt, api, access-token, auth0\
**Created:** [November 3, 2021, 2:38pm UTC](https://community.auth0.com/t/validating-auth0-token-spring-security/72569 "2021-11-03T14:38:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikhil.jaunjal](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nikhil.jaunjal/32/32194_2.png) [@nikhil.jaunjal](https://community.auth0.com/u/nikhil.jaunjal)\
**Post date:** [November 3, 2021, 2:38pm UTC](https://community.auth0.com/t/validating-auth0-token-spring-security/72569/1 "2021-11-03T14:38:42Z")

</div>

I am validating auth0 token in spring boot app with the help of [this official doc](https://auth0.com/docs/quickstart/backend/java-spring-security5/01-authorization#protect-api-endpoints)

While running the app, it is throwing below exception

```auto
2021-11-03 19:12:09.669 WARN 18128 --- [main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jwtDecoder' defined in class path resource [com/talenlio/common/security/SecurityConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.jwt.JwtDecoder]: Factory method 'jwtDecoder' threw exception; nested exception is java.lang.IllegalArgumentException: Unable to resolve the Configuration with the provided Issuer of "https://dummy/api"

```

Here is my application.yml file

```auto
spring:
 security:
    oauth2:
      resourceserver:
        jwt:
          issuer-uri: https://my-domain-at.auth0.com/

auth0:
  grantType: client_credentials
  audience: https://dummy/api
  clientId: XXXXXXXXX
  clientSecret: YYYYY
  applicationDomain: https://my-domain-at.auth0.com/

```

What things I need to take care for this?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [November 4, 2021, 8:40pm UTC](https://community.auth0.com/t/validating-auth0-token-spring-security/72569/3 "2021-11-04T20:40:06Z")

</div>

Hi @nikhil.jaunjal.

Thanks for reaching out to the Auth0 Community!

After looking at your stack trace, it appears that your app cannot resolve the audience you provided, specifically:

```auto
nested exception is java.lang.IllegalArgumentException: Unable to resolve the Configuration with the provided Issuer of "https://dummy/api"

```

In this scenario, I recommend that you double-check that you configured your Auth0 API correctly, and used the corresponding audience in your access token. It seems that the audience cannot be validated.

Please let me know how this works for you.

Thank you.

---

<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:** [December 6, 2021, 11:40pm UTC](https://community.auth0.com/t/validating-auth0-token-spring-security/72569/4 "2021-12-06T23:40:41Z")

</div>

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