huly-selfhost icon indicating copy to clipboard operation
huly-selfhost copied to clipboard

Gitlab as OIDC Error: did not find expected authorization request details in session, req.session["oidc:gitlab.mydomain.com"] is undefined

Open marvincorreia opened this issue 10 months ago • 9 comments

Issue using gitlab oidc as oidc provider

Environment variables:

HULY_VERSION=v0.6.429
HOST_ADDRESS=myhuly.mydomain.com
ACCOUNTS_URL=https://accounts-huly.mydomain.com
OPENID_CLIENT_ID=private
OPENID_CLIENT_SECRET=private
OPENID_ISSUER=https://gitlab.mydomain.com

Error:

Image

Logs:

{"level":"info","message":"try auth via","provider":"openid","timestamp":"2025-02-22T18:16:45.511Z"}

  Error: did not find expected authorization request details in session, req.session["oidc:gitlab.mydomain.com"] is undefined
      at /usr/src/app/bundle.js:210011:17
      at OpenIDConnectStrategy.authenticate (/usr/src/app/bundle.js:210059:9)
      at attempt (/usr/src/app/bundle.js:196557:20)
      at authenticate (/usr/src/app/bundle.js:196558:23)
      at /usr/src/app/bundle.js:197207:11
      at new Promise (<anonymous>)
      at /usr/src/app/bundle.js:197206:16
      at /usr/src/app/bundle.js:197181:11
      at new Promise (<anonymous>)
      at passportAuthenticate (/usr/src/app/bundle.js:197153:19)
      at router.get.email (/usr/src/app/bundle.js:210188:13)
      at dispatch (/usr/src/app/bundle.js:212328:36)
      at /usr/src/app/bundle.js:223081:20
      at dispatch (/usr/src/app/bundle.js:212328:36)
      at /usr/src/app/bundle.js:212320:16
      at dispatch (/usr/src/app/bundle.js:223085:35)

marvincorreia avatar Feb 22 '25 18:02 marvincorreia

Same question +1 !!

Error: did not find expected authorization request details in session, req.session["oidc:logto.example.com"] is undefined
      at /usr/src/app/bundle.js:161301:17
      at OpenIDConnectStrategy.authenticate (/usr/src/app/bundle.js:161349:9)
      at attempt (/usr/src/app/bundle.js:147752:20)
      at authenticate (/usr/src/app/bundle.js:147753:23)
      at /usr/src/app/bundle.js:148408:11
      at new Promise (<anonymous>)
      at /usr/src/app/bundle.js:148407:16
      at /usr/src/app/bundle.js:148382:11
      at new Promise (<anonymous>)
      at passportAuthenticate (/usr/src/app/bundle.js:148353:19)

My environment : using https://logto.io/

OPENID_ISSUER=https://logto.my.domain/oidc/.well-known/openid-configuration
ACCOUNTS_URL=https://huly-account.my.domain
Image

ShenQingchuan avatar Mar 13 '25 08:03 ShenQingchuan

Hello.

I have the same issue on v0.6.471 :

INF try auth via | provider=openid timestamp=2025-03-23T14:59:47.332Z
Error: did not find expected authorization request details in session, req.session["oidc:***********"] is undefined

except I'm on Keycloak and not Gitlab OIDC. It seams not related to specific provider.

EDIT: I succeeded in making it work. What did the trick was to simply use https://mydomain.com/_accounts as ACCOUNTS_URL. Actually, the guide at README is quite confusing as it tells you must expose the account service directly and use the direct URL as OIDC callback. It won't work, the good way is to use the child route of the main nginx front.

wafelmolt avatar Mar 23 '25 15:03 wafelmolt

I didn't resolve by comments above ...

After I set my ACCOUNTS_URL to https://mydomain.com/_accounts, after my OIDC provider callback, it redirects to https://mydomain.com/_accounts/auth/openid/callback which is the Huly's return point, so far so good ...

But then it jumps to https://mydomain.com/login !!! which is actually FRONT_URL/login ...

My OIDC login still not works at all, and I don't know why ...

ShenQingchuan avatar Apr 12 '25 14:04 ShenQingchuan

@ShenQingchuan are you still having same error in your logs ?

wafelmolt avatar Apr 13 '25 22:04 wafelmolt

@ShenQingchuan are you still having same error in your logs ?

yes

ShenQingchuan avatar Apr 15 '25 15:04 ShenQingchuan

So I guess that yours is redirected to /login because it is what happens when an OIDC error occurs. At least it seams logical. What is far less is "why is your OAuth2 authorization flow not working" ?

Actually, I checked your config and on my side, instead of .well-known, I put https://myidp.example.com/realms/my-realm as OPENID_ISSUER. It may be related to my use of keycloak. But maybe you would like to try that.

wafelmolt avatar Apr 16 '25 21:04 wafelmolt

@wafelmolt Greetings! We are facing the same issue as well with Authentik. We have set the ACCOUNTS_URL as per the document. did not find expected authorization request details in session, req.session["oidc:abc.xyz.com"] is undefined Please advice on how to resolve this.

sankethpb avatar Apr 30 '25 17:04 sankethpb

@wafelmolt It's working now, but unfortunately we do not know what fixed the issue. Thank you

sankethpb avatar May 01 '25 13:05 sankethpb

I face the same error. My Idp is keycloak. I expose the port 3000, and use nginx proxy manager it using another url. I'm using v0.6.502 @sankethpb did you manage to find out the cause of the issue? Thank you

cddev-global avatar Jun 20 '25 08:06 cddev-global