emil191995 opened a new issue, #12360:
URL: https://github.com/apache/apisix/issues/12360

   ### Current Behavior
   
   When I have 2 tabs of my app that redirected to login page and I login in 
first app second automaticaly redirects to redirect uri and returns 500 error 
for that page
   
   ### Expected Behavior
   
   the second need to redirect my app page without 500 error
   
   I debuged and found the issue.
   in library openidc when first tab logs in it ends the session and when 
second comes to redirect_uri page it can not find the session state with the 
args in request uri cos it is already expired. so the way I solwed in my side 
is this
   `
           if err then
               if session then
                   session:close()
               end
               if err == "unauthorized request" then
                   if conf.unauth_action == "pass" then
                       return nil
                   end
                   return 401
               end
               if err == "state from argument does not match state restored 
from session" then
                   ngx.redirect(url)
                   return nil
               end
               core.log.error("OIDC authentication failed: ", err)
               return 500
           end`
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   run apisix via docker image
   create route with plugin openid connect (I use keycloak as identity server)
   open 2 tabs of your app 
   login in first
   second redirects to redirect_uri
   
   ### Environment
   
   - APISIX version (run `apisix version`):
   - Operating system (run `uname -a`):
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
   - etcd version, if relevant (run `curl 
http://127.0.0.1:9090/v1/server_info`):
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`):
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to