Invalid Jwt access Token

Dears,

I can get the access token from the api /oauth/token

using correct grant-type, issuer, client-id, client-secret.

However when i call any api in my java Spring boot application, i got invalid token.

I’ve configured the java application with the correct audience and issuer url, and it was working before. Suddenly, now i receive invalid token error.

Please find the java configurations:

okta:
  oauth2:
    # Replace with the domain of your Auth0 tenant.
    issuer: ${OKTA_OAUTH2_ISSUER}
    # Replace with the API Identifier for your Auth0 API.
    audience: ${OKTA_AUD}

Also the error logs out of java application:

2026-02-01T10:28:07.975+02:00 DEBUG 4990 — [app] [nio-9092-exec-8] o.s.security.web.FilterChainProxy : Securing POST /users/user/followers
2026-02-01T10:28:08.009+02:00 DEBUG 4990 — [app] [nio-9092-exec-8] o.s.s.o.s.r.a.JwtAuthenticationProvider : Failed to authenticate since the JWT was invalid

Please help

Hi @doaa.farouk07

I am sorry about the delayed response. Can you confirm that in your API call to the /oauth/token endpoint you are using the correct issuer and audience?

The only causes for an invalid token error would be that an audience or issuer was not correctly provided and your application receives an opaque token which it cannot decode.

I would recommend checking your application.yml file to check if these are correct there as well.

Kind Regards,
Nik

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