Cannot log in React with OAUTH2 in Monolyth
Out of the box generated code does not work
Result


6.8.0
.yo-rc.json file
{
"generator-jhipster": {
"promptValues": {
"packageName": "com.somesite.someproj"
},
"jhipsterVersion": "6.8.0",
"applicationType": "monolith",
"baseName": "someproj",
"packageName": "com.somesite.someproj",
"packageFolder": "com/somesite/someproj",
"serverPort": "8080",
"authenticationType": "oauth2",
"cacheProvider": "ehcache",
"enableHibernateCache": false,
"websocket": "spring-websocket",
"databaseType": "mongodb",
"devDatabaseType": "mongodb",
"prodDatabaseType": "mongodb",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "gradle",
"enableSwaggerCodegen": false,
"embeddableLaunchScript": false,
"useSass": true,
"clientPackageManager": "npm",
"clientFramework": "react",
"clientTheme": "flatly",
"clientThemeVariant": "dark",
"creationTimestamp": 1587919421213,
"testFrameworks": ["cucumber"],
"jhiPrefix": "jhi",
"entitySuffix": "",
"dtoSuffix": "DTO",
"otherModules": [],
"enableTranslation": false,
"blueprints": []
}
}
entityName.json files generated in the .jhipster directory
JDL entity definitions
java version "11.0.7" 2020-04-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.7+8-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.7+8-LTS, mixed mode)
git version 2.25.1.windows.1
node: v12.0.0
npm: 6.9.0
Docker version 19.03.5, build 633a0ea
docker-compose version 1.25.4, build 8d51620a
INFO! Congratulations, JHipster execution is complete!
entityName.json files generated in the .jhipster directory
JDL entity definitions
java version "11.0.7" 2020-04-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.7+8-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.7+8-LTS, mixed mode)
git version 2.25.1.windows.1
node: v12.0.0
npm: 6.9.0
Docker version 19.03.5, build 633a0ea
docker-compose version 1.25.4, build 8d51620a
INFO! Congratulations, JHipster execution is complete!
Windows 10 Pro
Chrome Version 81.0.4044.122 (Official Build) (64-bit)
Firefox 75.0 (64-bit)
It worked after updating npm, however after a restart, the problem is back.
I've spent a lot of time debugging through the spring oauth token validation and it appeared the token was always expired.
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.
You might consider writing a note about this in the readme and spare some poor soul this trouble.
I've experienced time drift too when I had my computer's clock NOT synched to internet time. It's made live demos fail for me before and it certainly is frustrating. If you could create a PR to add it to our docs, that'd be great. The reason I'm asking you to do it is that I'm guessing you looked at the docs to try and figure this problem out.
If you did not look in our docs, adding something probably won't help. If that's the case, I think it'd be best that you re-create the problem and copy/paste the stack trace in this ticket so people can find it when they copy/paste/search for the error.
@mraible : I can add this to the documentation; but I haven't experienced this issue myself. Could you by any chance provide me a relevant link that I could refer to in the documentation?
@mraible : I've added a tip to the docs. Let me know if it needs any change. I couldn't find a link where this happens on Linux machines. Seems like it happens only on Windows and Macs. :thinking:
@SudharakaP Do you have a link to the PR that updates the docs?
Nevermind, I found it at https://github.com/jhipster/jhipster.github.io/pull/955.
Most helpful comment
Nevermind, I found it at https://github.com/jhipster/jhipster.github.io/pull/955.