directus / v8-archive

Directus Database API — Wraps Custom SQL Databases with a REST/GraphQL API
https://docs.directus.io/api/reference.html
505 stars 204 forks source link

SSO Authentication issue #2337

Open janbiasi opened 5 years ago

janbiasi commented 5 years ago

🐞 bug report

Is this a regression?

Don't know

Description

I'm trying to use SSO on my organization and while the configuration works and I'm able to authenticate, after a few minutes the app takes me back to the login screen without an error message.

Behaviour: Using SSO the App takes me back to the login screen after a few minutes Using SSO and hitting Refresh in the browser, the app logs the user out and is taken back to the login screen.

Setup: SSO: Okta and Azure (we built a custom provider) App: 7.6.2 API: 2.2.0

When I authenticate user X via user/password the app creates a window.sessionStorage object, which gets refreshed after the minutes specified under tokenExpiryTime in the App, but when I use SSO with the same user X (regardless of Azure or Okta) window.sessionStorage is empty:

Storage {length: 0}
length: 0__proto__: Storage

🔬 Minimal Reproduction

see https://github.com/directus/app/issues/1867

🔥 Exception or Error

see https://github.com/directus/app/issues/1867

🌍 Your Environment

latest SDK (5.x.x)

janbiasi commented 5 years ago

Current state:

Flow and assumption: When logging in through SSO, the login method in the SDK is skipped. The token is fetched directly from the api and then passed into the SDK. Because it's not going through that same login method, I don't think the refresh interval / local exp time is set correctly + it's not persisted to sessionStorage