-
-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERROR: attempt to index global 'openidc' (a nil value) #481
Comments
the error you see is in your code, you never assign any value to the variable
the other error indicates your redirect_uri is invoked without session cookie. You may need to explicitly set the cookie's |
Thank you for you answer, it helped solve a problem with 'openidc' (a nil value). Unfortunately problem with Ended up with this setup:
Anything I need to change here? Thank you. |
should be fine. You may want to check in the developer tools of your browser the session cookie is set correctly before you are sent over to your OpenID Connect provider and whether your client sends it back once it follows the redirect back. When you say
is Oh, I just see As far as examples go, the README of this project contains a working example for an OpenID Connect flow. |
Hi, thank you for reply, still no luck. As i mentioned, I tried pretty much every combination of config I could think of. set $session_cookie_secure on or off - nothing changes. Same for redirect_uri or redirect_uri_path. Still not sure what you by URI that I provide myself. /welcome is just random non-existing URI ( From all reading I understood that it should not be an actual page, correct?) Or is it needs to be some specific address? Checked cookies with development tools - I see that cookie is set and it is there. Keycloak authenticates successfully, I can see a session in keycloak. It just after redirect nothing works. I have suspicion that something wrong in a deeper level: dependencies, package versions? Did someone already launched it successfully on ubuntu 22? I tried the most basic setup from READ.ME - result is the same. Any advice is much appreciated. Thank you. |
You are correct, redirect_uri is not a page you provide, it has to be internal to lua-resty-openidc. So it has to be inside of a The error message you see really means "there is no session cookie". It could also mean "there is one but I can not read it" - which could be the case if there are two different machines in play. The cookie is encrypted and unless you specify an secret yourself, a new random one is created on each server start. I don't think this happens here. I don't believe it has got anything to do with dependencies at all. Do you see the session cookie being sent by your browser when the redirect from Keycloak to your /welcom URI happens? This is where it has to be included. Compare hostname, port and protocol of the URI accessed both when the cookie is set and when the redirect happens. They need to be the same. Also verify SameSite is not Strict and the cookie set is not setting the Secure flag unless you are actually using HTTPs. |
Hi, I am trying to make openresty authenticate with keycloak (v 21.1.1), but it is not working.
The errors I get:
authenticate(): request to the redirect_uri path but there's no session state found, client: xx.xx.xx.xx , server: lua-test.test.net, request: "GET /welcome?state=b17bd94747052c6223b484d7807f0215&session_state=e54c72ec-98ac-4dcc-b7fd-23872dffa66e&code=ef2f05ae-3147-4867-8e53-0e4ca67315a9.e54c72ec-98ac-4dcc-b7fd-23872dffa66e.b7a9c2ff-d8a2-4303-a4eb-8a96c34109e5 HTTP/1.1", host: "lua-test.test.net"
[error] 190628#190628: *4 lua entry thread aborted: runtime error: /etc/openresty/lua/main.lua:12: attempt to index global 'openidc' (a nil value)
Environment
Openresty Config
main.lua. script
Expected behaviour
Actual behaviour
Any idea what is wrong or where to look at?
My suspicion that some lua packages not working, but I checked all dependencies few times - everything looks fine.
Any suggestions how to debug it further?
Thanks.
The text was updated successfully, but these errors were encountered: