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

   ### Description
   
   I already talked about the issue I am facing in Slack.
   My use case is:
   I have a website, a frontend. This website needs to have the redirect to the 
OIDC provider. I want to do this with APISIX.
   The website has a session cookie with the session id of APISIX. This cookie 
doesn’t have any info on the user, as far as I know.
   How would I get the user info, like the username in the website?
   The X-Userinfo Header would only be available to other APIs I request with 
the session header.
   I want to display the username on the website after login.
   
   I already got to the point where I can get the X-Userinfo Header to the 
frontend with this config:
   `{
     "uri": "/*",
     "plugins": {
       "openid-connect": {
         "bearer_only": false,
         "client_id": "clientid",
         "client_secret": "secret",
         "discovery": "openid_endpoint",
         "redirect_uri": "http://localhost:9080/";
       },
       "response-rewrite": {
         "headers": {
           "Custom-Header": "$http_x_userinfo"
         }
       }
     },
     "upstream": {
       "nodes": [
         {
           "host": "httpbin.org",
           "port": 80,
           "weight": 1
         }
       ]
     }
   }`
   
   I want to put the userinfo inside of a cookie so I can access it more easily 
in my frontend.
   But if I do this:
   `...
           "Set-Cookie": "userinfo=$http_x_userinfo"
   ...`
   The OIDC flow won't work anymore. I think it overrides the Set-Cookies from 
the OIDC plugin.
   This is the error I am getting:
   `[lua] openidc.lua:1378: authenticate(): request to the redirect_uri path 
but there's no session state found`
   
   I hope someone can help me with this :D
   
   ### Environment
   
   - APISIX version (run `apisix version`): 2.13
   - Operating system (run `uname -a`): I use APISIX in Docker but my Operating 
system is: Darwin legendre.local 20.6.0 Darwin Kernel Version 20.6.0: Tue Feb 
22 21:10:41 PST 2022; root:xnu-7195.141.26~1/RELEASE_X86_64 x86_64
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): 
openresty/1.19.9.1
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to