Skip to content

fix: [UIE-9661] - oAuth callback improvements - #13105

Merged
abailly-akamai merged 13 commits into
linode:developfrom
abailly-akamai:UIE-9661
Dec 4, 2025
Merged

fix: [UIE-9661] - oAuth callback improvements#13105
abailly-akamai merged 13 commits into
linode:developfrom
abailly-akamai:UIE-9661

Conversation

@abailly-akamai

@abailly-akamai abailly-akamai commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

Description 📝

This PR attempts to fix a couple issues with the oAuth callback.

  1. Logout loop
  2. Random redirect so login

Changes 🔄

  • improve the oAuthcallback run cycle
  • prevent auth routes from becoming redirect paths
  • wait for router initiation to make redirect decisions

Scope 🚢

Upon production release, changes in this PR will be visible to:

  • All customers
  • Some customers (e.g. in Beta or Limited Availability)
  • No customers / Not applicable

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-9661

However, on a slow connection this can easily be reproduced:

  • Throttle your network
  • Open user menu and click logout before authentication thru profile went through
    • 🚫 logout loop happens as redirect URL is /logout

Verification steps

  • Throttle your network
  • Open user menu and click logout before authentication thru profile went through
    • ✅ successfully logged in to Cloud Manager

👉 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

  • I have read and considered all applicable items listed above.

As an Author, before moving this PR from Draft to Open, I confirmed ✅

  • All tests and CI checks are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

? getQueryParamsFromQueryString(options.params)
: options.params
)
);

Copy link
Copy Markdown
Contributor Author

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,

Copy link
Copy Markdown
Contributor Author

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',
];

Copy link
Copy Markdown
Contributor Author

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);

Copy link
Copy Markdown
Contributor Author

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) {

Copy link
Copy Markdown
Contributor Author

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

@abailly-akamai
abailly-akamai marked this pull request as ready for review November 20, 2025 10:14
@abailly-akamai
abailly-akamai requested a review from a team as a code owner November 20, 2025 10:14
@linode-gh-bot

Copy link
Copy Markdown

Cloud Manager UI test results

🎉 862 passing tests on test run #13 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
0 Failing862 Passing11 Skipped35m 12s

@jdamore-linode jdamore-linode left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @abailly-akamai! I can't reproduce the login issue against a locally served copy of develop or this branch so I can't verify that the issue is fixed, but I'm not observing any regressions either. I'll be sure to cover this during release testing if we don't find a way to test this in the meantime

@github-project-automation github-project-automation Bot moved this from Review to Approved in Cloud Manager Dec 4, 2025
@abailly-akamai
abailly-akamai merged commit 9147732 into linode:develop Dec 4, 2025
35 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Merged in Cloud Manager Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants