Skip to content

5. Action Creators & Constants

Maximilian Mantz edited this page Jan 10, 2017 · 3 revisions

This package offers a number of redux action creators and constants to manage OIDC interactions with your redux app.

Action Creators

import { userExpired, redirectSuccess, userFound, silentRenewError, sessionTerminated, userExpiring, userSignedOut } from 'redux-oidc';

All of these action creators are used by this package. The actions are dispatched by the oidcMiddleware, CallbackComponent & on UserManager events.


userExpired

Payload: none

Dispatched when: current user is expired

Effects: reducer sets user to null.


redirectSuccess

Payload: user - the newly obtained user.

Dispatched when: redirection callback succeeded in CallbackComponent.

Effects: reducer sets the user property.


userFound

Payload: user - the found user.

Dispatched when: an existing user has been found during startup of the middleware.

Effects: reducer sets the user.


silentRenewError

Payload: error the error thrown by silent renew.

Dispatched when: silent renew fails.

Effects: reducer sets user to null.


sessionTerminated

Payload: none

Dispatched when: the current session is terminated (user is logged out).

Effects: reducer sets user to null


userExpiring

Payload: none

Dispatched when: the current user is expiring (right before silent renew is triggered, if configured).

Effects: none


loadingUser

Payload: none

Dispatched when: the loading process of a new user starts.

Effects: sets isUserLoading to true


userSignedOut

Payload: none

Dispatched when: the user signs out.

Effects: user is set to null, isLoadingUser is set to false.


Constants

The following constants are used with the action creators:

import { USER_EXPIRED, REDIRECT_SUCCESS, USER_FOUND, SILENT_RENEW_ERROR, USER_EXPIRING, SESSION_TERMINATED, LOADING_USER, USER_SIGNED_OUT } from 'redux-oidc';