generator-jhipster: Unable to login using oAuth2/OKTA with docker-compose prod package - Error 'User could not be found'

Overview of the issue

Login doesn’t work with oAuth2/Okta using docker-compose: Error 500 - ‘User could not be found’. But, login works well when using keycloak instead of OKTA. The error occurred only with prod profile and docker-compose.

Motivation for or Use Case

Testing OIDC

Reproduce the error
  • Generate o Monolith app with oAuth2 option
  • Change OpenID Connect Settings to use OKTA instead of Keycloak: src/main/docker/app.yml and src/main/resources/application.yml
  • build docker image using ‘./mvnw verify -Pprod dockerfile:build -DskipTests’
  • Start app using ‘docker-compose -f src/main/docker/app.yml up -d’
Related issues

#7609

JHipster Version(s)
jhipster@5.0.0-beta.1

JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.test.monolith",
      "nativeLanguage": "en"
    },
    "jhipsterVersion": "5.0.0-beta.1",
    "baseName": "monolith",
    "packageName": "com.test.monolith",
    "packageFolder": "com/test/monolith",
    "serverPort": "8080",
    "authenticationType": "oauth2",
    "cacheProvider": "hazelcast",
    "enableHibernateCache": true,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "postgresql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "clientFramework": "angularX",
    "useSass": true,
    "clientPackageManager": "yarn",
    "applicationType": "monolith",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": [
      "en",
      "fr"
    ]
  }
}
Environment and Tools

java version “1.8.0_144” Java™ SE Runtime Environment (build 1.8.0_144-b01) Java HotSpot™ 64-Bit Server VM (build 25.144-b01, mixed mode)

git version 2.13.1 node: v8.11.1 npm: 5.6.0 yeoman: 2.0.0 yarn: 1.6.0 Docker version 18.03.0-ce, build 0520e24 docker-compose version 1.20.1, build 5d8c71b

Browsers and Operating System
  • MacOS 10.13.4
  • Chrome

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (17 by maintainers)

Most upvoted comments

If it doesn’t work in docker-compose, it might be caused by the variables set in src/main/docker/app.yml. If you already have them defined in src/main/resources/config/application.yml, there’s no need to override them in app.yml.

I’d try deleting the “SECURITY_OAUTH2_*” keys in app.yml and see if that fixes it.

On May 21, 2018, at 7:23 AM, Mustapha Aznag notifications@github.com wrote:

No, only with docker-compose. It works well with ‘./mvnw -Pprod -DskipTests’

https://user-images.githubusercontent.com/23117630/40312385-0c27f4be-5d13-11e8-94ad-f9749721032b.png https://user-images.githubusercontent.com/23117630/40312400-13a31124-5d13-11e8-896c-467b37ab1b5b.png https://user-images.githubusercontent.com/23117630/40312410-18ec13ce-5d13-11e8-8d03-e303861bdd13.png — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jhipster/generator-jhipster/issues/7612#issuecomment-390669234, or mute the thread https://github.com/notifications/unsubscribe-auth/AABF5BIh01fHWLuD-_VS09U3fOWqBaB8ks5t0s3ugaJpZM4T70kJ.