nokia / kong-oidc

OIDC plugin for Kong
Apache License 2.0
455 stars 320 forks source link

request to the redirect_uri path but there's no session state found #208

Open jahanzaib91 opened 1 year ago

jahanzaib91 commented 1 year ago

Hi,

We have a backend service which is proxied using kong. We need to enabled OIDC authentication for this service and we are using this oidc plugin. Okta is our Identity Provider. We have the following configuration in our .yaml file for the service/route at kong along with oidc plugin configuration

_version: 3
name: some-service
proxy:
  path: /
  protocol: http
  targets:
    - host: <host>:<port>
  plugins:
    - name: oidc
      config:
        responseType: code
        clientId: <cliendId>
        scope: openid
        clientSecret: <clientSecret>
        discovery: https://<okta-hostname>/.well-known/openid-configuration
        redirect_uri_path: /somepath
routes:
  - name: <name>
    hosts:
      - app1.host1
    paths:
      - /somepath
    protocols:
      - https

When we access the route through kong i.e , kong successfully redirects to Okta for authentication. After providing authentication credentials, Okta successfully redirects the request back https://app1.host1/somepath with authorization code and state parameter in the URL. However, kong throws the following error

request to the redirect_uri path but there's no session state found

Please note that the similar configuration is working fine in another environment (another instance of kong with another instance of Okta). So we are unsure what would be causing this issue. Any ideas or pointers regarding it would be highly appreciated.

liweitianux commented 1 year ago

It looks like you were using the same URI for redirect_uri_path, which should be the cause.

Please have a look at https://github.com/apache/apisix/issues/2426 and it might be helpful.

pdomineaux commented 1 year ago

@jahanzaib91 Have you finally found the root cause of your problem ? I'm encounter the same issue on my side....