-
Notifications
You must be signed in to change notification settings - Fork 387
fix: [UIE-9661] - oAuth callback improvements #13105
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
base: develop
Are you sure you want to change the base?
Conversation
| ? getQueryParamsFromQueryString(options.params) | ||
| : options.params | ||
| ) | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just added some typeguard here to satisfy the new callback strict route types
| const authenticate = async () => { | ||
| try { | ||
| const { returnTo } = await handleOAuthCallback({ | ||
| params: location.search, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one potential issue:
here we were using windows.location which means it would get evaluated (and return a value) before router initiation.
| '/admin/callback', | ||
| '/oauth/callback', | ||
| '/cancel', | ||
| ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the fix to not redirect to one of these routes in order to never be stuck in a logout loop
| }); | ||
|
|
||
| const hasStartedAuth = React.useRef(false); | ||
| const isAuthenticating = React.useRef(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using references to avoid triggering the callback more than needed and end up with stale values
| profile: Profile | undefined | ||
| ): Promise<boolean> => { | ||
| if (!flags?.iam?.enabled) { | ||
| if (!flags?.iam?.enabled || !profile) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not directly related to this PR. just a follow up to #13037
Cloud Manager UI test results🔺 1 failing test on test run #7 ↗︎
Details
TroubleshootingUse this command to re-run the failing tests: pnpm cy:run -s "cypress/e2e/core/helpAndSupport/open-support-ticket.spec.ts" |
|||||||||||||||||
Description 📝
This PR attempts to fix a couple issues with the oAuth callback.
Changes 🔄
Scope 🚢
Upon production release, changes in this PR will be visible to:
How to test 🧪
Reproduction steps
Some of this isn't consistently reproducible, happens on various network speed and/or reasons unbeknown to us mortals.
see ticket for details:
M3-9661However, on a slow connection this can easily be reproduced:
/logoutVerification steps
👉 try all sorts of logins & logouts in various environments at various network speeds
Author Checklists
As an Author, to speed up the review process, I considered 🤔
👀 Doing a self review
❔ Our contribution guidelines
🤏 Splitting feature into small PRs
➕ Adding a changeset
🧪 Providing/improving test coverage
🔐 Removing all sensitive information from the code and PR description
🚩 Using a feature flag to protect the release
👣 Providing comprehensive reproduction steps
📑 Providing or updating our documentation
🕛 Scheduling a pair reviewing session
📱 Providing mobile support
♿ Providing accessibility support
As an Author, before moving this PR from Draft to Open, I confirmed ✅