Skip to content

bug: openid-connect plugin doesn't redirect after logout #6791

Description

@mehmetcuneyit

Current Behavior

I would like to integrate APISIX gateway with auth0 using openid-connect plugin.
After a request is sent to /logout, the session is invalidated on the server side and session= field in the cookie set to empty on the client side. In addition to that a request needs be sent to auth0's logout endpoint ( see here ). So, post_logout_redirect_uri field is configured in the plugin to make logout request to the auth0 endpoint, but it doesn't redirect.

Expected Behavior

When post_logout_redirect_uri is configured in openid-connect plugin, it should redirect user to the given URI after a request sent to the /logout endpoint on the gateway.

Error Logs

No errors printed to /usr/local/apisix/logs/error.log

Steps to Reproduce

  1. Run APISIX via the Docker deployment
cd example
docker-compose -p docker-apisix up -d
  1. Create a Route in the dashboard
  2. Enable/Configure openid-connect plugin (Scope: global).
{
  "access_token_in_authorization_header": true,
  "bearer_only": false,
  "client_id": "{client_id}",
  "client_secret": "{client_secret}",
  "disable": false,
  "discovery": "https://{domain}.us.auth0.com/.well-known/openid-configuration",
  "introspection_endpoint_auth_method": "client_secret_post",  
  "realm": "master",
  "redirect_uri": "http://127.0.0.1:9080/",
  "scope": "openid profile",
  "post_logout_redirect_uri": "https://{domain}.us.auth0.com/v2/logout?client_id={client_id}&returnTo=http://127.0.0.1:9080/app",
}
  1. Authenticate user by going to any defined route on the gateway ( e.g. /protected ). It will redirect user to the auth0 login page .
  2. Go to /logout, no redirection happens.

Screenshot from 2022-04-04 12-41-29

Environment

  • APISIX version (run apisix version): 2.13.0
  • Operating system (run uname -a): the apisix docker image
  • OpenResty / Nginx version (run openresty -V or nginx -V): nginx version: openresty/1.19.9.1
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info): the apisix docker image
  • APISIX Dashboard version, if relevant: 2.10.1
  • Plugin runner version, for issues related to plugin runners: -
  • LuaRocks version, for installation issues (run luarocks --version): -

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status
✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions