An example of flask api integration with CRA
If you really want to create a client react app with session-based authentication.
It does seem counter-intuative to use a stateful server with a stateless Single Page App, but there may be situations (eg. required to integrate with an existing session-based Api) where you can't use tokens.
Notes:
localhost:5000
.lsLoggedIn
value in state. The front end does not track cookie expiry, etc.isLoggedIn: true
and the cookie does expire, the server will return a 401
and the app redux state will change to isLoggedIn: false
React structure inspired by this container pattern.
Auth managed via flask-login.
Redux actions/reducers based on login-flow.
cd client
nvm use
npm install
npm start
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
python run.py
npm run prettier