I'm trying to use keycloak to get access tokens,
but I get the error Token is expired
when trying to use the tokens issued by keycloak
For example, if I get a token using curl:
curl -u account:___mysecret___ -k
-d "grant_type=password&username=testuser&password=__some__pass"
-H "Content-Type:application/x-www-form-urlencoded"
http://localhost:8080/auth/realms/testRealm/protocol/openid-connect/token
and decode the returned token using jwt.io, I can see that the exp date is yesterday's date.
how do I get usable access tokens?
I think you were using keycloak with docker desktop on windows.
And your localtime of your hyperV where not synchronize anymore with your host computer.
If you wrote : date in your docker container, the date is wrong.
So the token genreate by keycloak was outdated
So rebooting hyperV resynchronize the localtime in your docker container.
More info here : How to make sure docker's time syncs with that of the host?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With