Generator-jhipster: Login Error React UI

Created on 28 Apr 2020  路  7Comments  路  Source: jhipster/generator-jhipster

Overview of the issue

Cannot log in React with OAUTH2 in Monolyth

Motivation for or Use Case

Out of the box generated code does not work

Reproduce the error
  1. Generate project
  2. Run docker-compose -f src/main/docker/keycloak.yml up (tested to work http://localhost:9080/)
  3. Run gradlew
  4. Run npm start
  5. Log in with default user

Result

image
image

JHipster Version(s)

6.8.0

JHipster configuration


.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": []
  }
}

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory


JDL entity definitions


Environment and Tools

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!

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory


JDL entity definitions


Environment and Tools

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!

Browsers and Operating System

Windows 10 Pro
Chrome Version 81.0.4044.122 (Official Build) (64-bit)
Firefox 75.0 (64-bit)

  • [x] Checking this box is mandatory (this is just to show you read everything)
area react

Most helpful comment

All 7 comments

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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Steven-Garcia picture Steven-Garcia  路  3Comments

marcelinobadin picture marcelinobadin  路  3Comments

trajakovic picture trajakovic  路  4Comments

kaidohallik picture kaidohallik  路  3Comments

shivroy121 picture shivroy121  路  3Comments