enso icon indicating copy to clipboard operation
enso copied to clipboard

Fix broken login flow

Open MrFlashAccount opened this issue 1 year ago • 1 comments

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:

  1. Makes ENSO_CLOUD_REDIRECT optional
  2. Uses window.location.origin as a defualt redirect URL
  3. 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.

MrFlashAccount avatar May 15 '24 13:05 MrFlashAccount

@somebody1234 awaiting QA

MrFlashAccount avatar May 17 '24 14:05 MrFlashAccount

QA 🟢

PabloBuchu avatar May 22 '24 12:05 PabloBuchu