William Petit 713b8cc3ea Authentification OpenID Connect
Implémentation du modèle d'authentification "Authorization code with
PKCE [1]"

[1] https://auth0.com/docs/api-auth/tutorials/authorization-code-grant-pkce
2020-06-19 19:11:28 +02:00

21 lines
514 B
TypeScript

import { UnauthorizedError } from "../../util/daddy";
import { put, all, takeEvery } from 'redux-saga/effects';
import { logout } from '../actions/auth';
export function* failureRootSaga() {
yield all([
takeEvery(patternFromRegExp(/^.*_FAILURE/), failuresSaga),
]);
}
export function* failuresSaga(action) {
if (action.error instanceof UnauthorizedError) {
yield put(logout());
}
}
export function patternFromRegExp(re: any) {
return (action: any) => {
return re.test(action.type);
};
}