dna
dna

Reputation: 626

Keycloak jwt expired

I am creating an application with Jhipster. To do this, I want to use the Keycloak authentication server. But as soon as I log in I get the following message : Statut : Internal Server Error (Internal Server Error) Message : An error occurred while attempting to decode the Jwt: Jwt expired at 2019-06-04T00:20:05Z

My .yo-rc.json :

{
"generator-jhipster": {
"promptValues": {
  "packageName": "com.mycompany.front.project",
  "nativeLanguage": "fr"
},
"jhipsterVersion": "6.0.1",
"applicationType": "gateway",
"baseName": "frontProduit",
"packageName": "com.mycompany.front.project",
"packageFolder": "com/mycompany/front/project",
"serverPort": "8080",
"authenticationType": "oauth2",
"cacheProvider": "ehcache",
"enableHibernateCache": true,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "postgresql",
"prodDatabaseType": "postgresql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": "consul",
"buildTool": "maven",
"enableSwaggerCodegen": false,
"clientFramework": "angularX",
"clientTheme": "none",
"clientThemeVariant": "",
"useSass": true,
"clientPackageManager": "npm",
"testFrameworks": [],
"jhiPrefix": "jhi",
"entitySuffix": "",
"dtoSuffix": "DTO",
"otherModules": [],
"enableTranslation": true,
"nativeLanguage": "fr",
"languages": [
  "fr",
  "en"
]
}
}

Upvotes: 2

Views: 1196

Answers (1)

Cristian Stancalau
Cristian Stancalau

Reputation: 191

This problem haunted me for 3 days but I finally figured it out. It has to do with the local Docker client time getting out of sync with your OS. This happens particularly when you put the computer to sleep. That is when Docker experiences "time drift". The solution is to restart the Docker client before you run your Keycloak image.

If you are running Keycloak on a different machine, then it would have to have the same date time set to the machine that runs the java server.

Upvotes: 7

Related Questions