Fix broken login flow
Pull Request Description
Tl;dr
Closes: enso-org/cloud-v2#1231 This PR makes the ENSO_CLOUD_REDIRECT env variable optional and uses window.location.origin as a redirect url by default
Context:
In the recent PR we have changed the server address where we start the electron app from 'http' to 'https'. This change was caused by the Stripe live mode that doesn't work in the HTTP environment. But now we have different origins based on where we launched the app. So we decided to make the ENSO_CLOUD_REDIRECT env variable optional and use window.location.origin as a redirect URL by default. Also, we found a bug if the electron server started on a different port, let's say 8081(this might happen if 8080 is already in use) and the server will be implicitly redirected from 8081 to 8080 after login. We decided to explicitly kill the app and show the error in the console. This is because we need to specify allowed redirect URLs in COGNITO explicitly to make the login flow work.
This Change:
- Makes ENSO_CLOUD_REDIRECT optional
- Uses window.location.origin as a defualt redirect URL
- Throw an error if the port is in use when starting an electron app
Test Plan:
Go over how you plan to test it. Your test plan should be more thorough the riskier the change is. For major changes, I like to describe how I E2E tested it and will monitor the rollout.
Important Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
- [ ] The documentation has been updated, if necessary.
- [ ] Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
- [ ] All code follows the Scala, Java, TypeScript, and Rust style guides. In case you are using a language not listed above, follow the Rust style guide.
- [ ] Unit tests have been written where possible.
@somebody1234 awaiting QA
QA 🟢