Nerzal / gocloak

golang keycloak client
Apache License 2.0
1.01k stars 275 forks source link

Token used before issued #439

Open SaiTejaSuvvari opened 1 year ago

SaiTejaSuvvari commented 1 year ago

Describe the bug DecodeAccessToken returns error 'token used before issued'

To Reproduce Steps to reproduce the behavior: (keycloak setup using podman compose)

  1. Call LoginAdmin using admin credentials
  2. Call DecodeAccessToken from access token string obtained in the above step
  3. Got error

Expected behavior Token is issued and returned by keycloak. Decode Access Token parses it to the custom data types. Not sure why this error is produced.

Keycloak setup in podman compose keycloak: image: quay.io/keycloak/keycloak:22.0.0 ports:

ctradu commented 9 months ago

The issue seems to appear when there is a time skew between the keycloak server and the client that issued the token. It should be fixed by https://github.com/Nerzal/gocloak/commit/08a69ff6f3ced539fa378c1a93a90e1da524bc95

See also: https://github.com/golang-jwt/jwt/blob/main/MIGRATION_GUIDE.md for v5.0.0 And: https://github.com/golang-jwt/jwt/issues/98

AndreFK commented 7 months ago

Im running into this same error, and I'm using the following version

github.com/Nerzal/gocloak/v13 v13.8.0