Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken login flow #9965

Merged
merged 3 commits into from
May 22, 2024
Merged

Conversation

MrFlashAccount
Copy link
Contributor

@MrFlashAccount MrFlashAccount commented May 15, 2024

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 MrFlashAccount self-assigned this May 15, 2024
@MrFlashAccount MrFlashAccount added CI: No changelog needed Do not require a changelog entry for this PR. --bug Type: bug g-dashboard labels May 15, 2024
Copy link
Collaborator

@somebody1234 somebody1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR passed ✅
QA not done (at least not yet)

Copy link
Contributor

@Frizi Frizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving the vite config modification.

app/ide-desktop/lib/client/src/bin/server.ts Outdated Show resolved Hide resolved
app/ide-desktop/lib/client/src/index.ts Show resolved Hide resolved
app/ide-desktop/lib/client/watch.ts Outdated Show resolved Hide resolved
@MrFlashAccount MrFlashAccount force-pushed the wip/sergeigarin/fix-broken-login branch from 9ff5dbe to eb67ba4 Compare May 17, 2024 14:26
@MrFlashAccount
Copy link
Contributor Author

MrFlashAccount commented May 17, 2024

@somebody1234 awaiting QA

@PabloBuchu
Copy link
Contributor

QA 🟢

limit the port range with single one

Make ENSO_CLOUD_REDIRECT optional, use window.location.origin by default
@MrFlashAccount MrFlashAccount force-pushed the wip/sergeigarin/fix-broken-login branch from 62474b4 to 523ccfb Compare May 22, 2024 13:13
@MrFlashAccount MrFlashAccount added the CI: Ready to merge This PR is eligible for automatic merge label May 22, 2024
@MrFlashAccount MrFlashAccount merged commit 91a2afb into develop May 22, 2024
34 of 36 checks passed
@MrFlashAccount MrFlashAccount deleted the wip/sergeigarin/fix-broken-login branch May 22, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
--bug Type: bug CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge g-dashboard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants