-
Notifications
You must be signed in to change notification settings - Fork 2
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.
The login process is handled by a thunk action in the user
application module located in /app/user/actions/login.ts
.
- Request a new access token from application credentials, or try to refresh the token
- Fetch the user session with the new valid access token
- Check user's permission to grant his application's access
- Register the device to receive push-notifications
- Confirm login (fill the Redux application state with user session)
- Track login (see "Tracking" section of this documentation)
- Send user to the Timeline page
The logout process consists only to erase the stored auth token and to empty the user
reducer.
- Track logout (see "Tracking" section of this documentation)
- Unregister the device to not receive push-notifications anymore
- Erase the stored access token
- Clear requests cache (see "Signed fetch" section in this documentation)
- Validate logout (empty the user session in Redux application state)
- Send user to the login page
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.