-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Firstly I wanted to thank you for your awesome library @alexbilbie :)
For the Password Grant, why are existing sessions deleted when the new session is created?
public function completeFlow($inputParams = null)
{
...
// Delete any existing sessions just to be sure
$this->authServer->getStorage('session')->deleteSession($authParams['client_id'], 'user', $userId);
// Create a new session
$sessionId = $this->authServer->getStorage('session')->createSession(
...
}The Password Grant is often used for first-party "official" mobile apps. A user may wish to install such an app on two devices (eg: an iPhone and an iPod touch) and stay signed in on both of them.
With the existing functionality in the Password Grant, when the user signs in on their second device, deleteSession() will delete their first session from the oauth_sessions table, effectively signing them out from their first device.
If the call to deleteSession() was removed, then oauth_sessions could contain an unlimited number of sessions per user, enabling a user to stay signed in on an unlimited number of devices. Sessions can be deleted from oauth_sessions when:
- The session doesn't have a refresh token, and the current time passes
access_token_expires, or - The session does have a refresh token, and a very large amount of time (eg: a year) has passed since
access_token_expires(it's very unlikely that the refresh token will be used a year after the access token has expired).
This is similar to Issue #25. The difference is:
- Issue Refresh Token Grant - scope limitation and additional access tokens #25 concerns the Refresh Token Grant, creating multiple access tokens using one refresh token.
- This issue concerns the Password Grant, creating multiple access tokens by signing in with username and password on multiple devices.