Skip to content

Conversation

@abailly-akamai
Copy link
Contributor

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

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

Cloud Manager UI test results

🔺 1 failing test on test run #7 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
1 Failing861 Passing11 Skipped48m 55s

Details

Failing Tests
SpecTest
open-support-ticket.spec.tsCloud Manager Cypress Tests→open support tickets » can create a support ticket with an entity

Troubleshooting

Use this command to re-run the failing tests:

pnpm cy:run -s "cypress/e2e/core/helpAndSupport/open-support-ticket.spec.ts"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Review

Development

Successfully merging this pull request may close these issues.

2 participants