Skip to content

authentication

Rafik Djedjig edited this page May 7, 2019 · 2 revisions

Authentication

This pages describes how to use ODE platform authentification and autorisation server to log a user and fetch its session. The authentication process works over oAuth2 protocol (to be more precise it use Resource Owner Password Credentials).

Once a user is logged in, Mobile Framework stores the access token in the oauth module located in /app/infra/oauth.ts.This access token is required to sign fetch requests and data sources.

Login routine

The login process is handled by a thunk action in the user application module located in /app/user/actions/login.ts.

  1. Request a new access token from application credentials, or try to refresh the token
  2. Fetch the user session with the new valid access token
  3. Check user's permission to grant his application's access
  4. Register the device to receive push-notifications
  5. Confirm login (fill the Redux application state with user session)
  6. Track login (see "Tracking" section of this documentation)
  7. Send user to the Timeline page

Logout routine

The logout process consists only to erase the stored auth token and to empty the user reducer.

  1. Track logout (see "Tracking" section of this documentation)
  2. Unregister the device to not receive push-notifications anymore
  3. Erase the stored access token
  4. Clear requests cache (see "Signed fetch" section in this documentation)
  5. Validate logout (empty the user session in Redux application state)
  6. Send user to the login page

Me

The Me module is a read-only access to the gathered user session at login time. You just have to import it from /app/infra/Me.ts and check Me.session content.

The Me module also contains functions to set or read distant user preferences and is user by the user application module to handle push-notifs preferences.

The Me module is not respectful of the Redux architecture and causes circular dependencies. It will be removed in favor of the data directly obtained from the Redux store.

Clone this wiki locally