Deploy and Test Cognito Cross Sites
- Create a app/.env.local file for app1 and app2 with the following content:
REACT_APP_USERPOOL_ID=YOUR_USER_POOL_ID
REACT_APP_CLIENT_ID=YOUR_CLIENT_ID

- Use Create React App to set up the development process:
- The next steps will be familiar.
- Install and run web1 on port 3000:
cd app
npm install --force
npm start
Note: For MacBook, adjust the package.json file in the app directory as follows:
"scripts": {
"start": "PORT=3000 && react-scripts start",
...
},

- Install and run web2:
cd app2
npm install --force
npm start

-
After initializing web 1, you access web1 via localhost:3000
- Then, you log in, select SIGN IN WEB1

- In the web1 login interface, if you do not have an account, select Register a new account. If you already have an account, fill in all the information and select SIGN IN

- Successful login, the interface looks like the image.

-
Then access web2 via the address localhost:3001
- You will be surprised because you do not need to log in to still see the web2 interface (remember to hit load or f5 if you do not see the web2 interface).

- Go back to the web1 interface and log out by selecting SIGN OUT WEB1

- When you reload the web2 page, you will no longer be able to see the web2 interface.
