Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Approach to authorisation with One-App #521

Answered by JAdshead
johnlister asked this question in Q&A
Discussion options

You must be logged in to vote

You should be able to follow the classic OAuth flows. If you can i would avoid setting tokens in state, instead I would suggest looking at making use of createBrowserLikeFetch and thecreateSsrFetch api to use cookies from the initial request from the browser to other server side fetch requests and also setting cookies on the server response.

A good place to handle some of the auth flow might be in a modules onEnterRouteHook

MyModule.onEnterRouteHook = (store) => (nextState, replace, callback) => {
  store.dispatch(authenticate()).then(() => {
    if (!store.getState().isAuthenticated) replace('/login');
    callback();
  });
};

dispatching an action gives access to the configured ssr fet…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by 10xLaCroixDrinker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants