Redux Auth0 middleware
In the project directory, you can run:
yarn add redux-auth0
(or npm install redux-auth0
)
Initialise your store:
;;
const createStore: createStoreWithAuth0 middleware:auth0middleware reducer: auth = ;
const middlewares = /*any middleware*/ auth0middleware;
//Use redux-auth0 createStoreconst store = ;
Username password authentication
store;
Login with google
store;
On social connection success, you'll be redirected to the callback url configure above, so you have to parse the url to recover your token.
For example, with redux-first-router, you will have something like so:
;
const routes = PRIVATE_ROUTE: '/private' AUTHORIZE: path: '/callback' thunk: async { try const authResult = await ; ; ; catch error /* ... */ }