Skip to content

fix: [PDI-3249] - Use sessionStorage for codeVerifier and nonce: update OAuth and storage#13570

Open
mkaminsk-akamai wants to merge 2 commits intolinode:developfrom
mkaminsk-akamai:sessionStorage_for_codeVerifier
Open

fix: [PDI-3249] - Use sessionStorage for codeVerifier and nonce: update OAuth and storage#13570
mkaminsk-akamai wants to merge 2 commits intolinode:developfrom
mkaminsk-akamai:sessionStorage_for_codeVerifier

Conversation

@mkaminsk-akamai
Copy link
Copy Markdown
Contributor

@mkaminsk-akamai mkaminsk-akamai commented Apr 9, 2026

Description 📝

@pmakode-akamai This is a code snipplet which can help to reproduce the case when user who has multiple CM tabs open receives message in console that codeVerifier not being found. You can reproduce it locally when you point local APIV4 environment to production APIV4 so CM will get 401s each time.
Without changes to storage.ts you should be able to reproduce the message with codeVerifier not being found.
If you apply changes from storage.ts the issue seems to be gone, since when there are multiple tabs open the codeVerifier may overwritten in local storage, thus I switching in this code snipplet to use sessionStorage seems to resolve it.

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

Target release date 🗓️

April End

How to test 🧪

Reproduction steps

You can use this config for reproducing it: Login in DevCloud will work fine, APIv4 will give 401s. You can use this client id from DevCloud 'c19a605edc88b07242fa':

REACT_APP_APP_ROOT='http://localhost:3000'
REACT_APP_API_ROOT='https://api.linode.com/v4'
REACT_APP_LOGIN_ROOT='https://login.devcloud.linode.com'
REACT_APP_CLIENT_ID='c19a605edc88b07242fa'

Verification steps

  • No code verifier found in local storage. Please try logging in again. alert should not appear while testing in multiple tabs. (Note: this alert message appears intermittently without these changes, and these PR changes are supposed to fix this problem)

Note

alert('No code codeVerifier found in local storage when running OAuth callback.'); should be removed before merging this PR

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

@mkaminsk-akamai mkaminsk-akamai requested a review from a team as a code owner April 9, 2026 12:02
@mkaminsk-akamai mkaminsk-akamai marked this pull request as draft April 9, 2026 12:03
@mkaminsk-akamai mkaminsk-akamai changed the title Use sessionStorage for codeVerifier: update OAuth and storage Use sessionStorage for codeVerifier and nonce: update OAuth and storage Apr 9, 2026
@pmakode-akamai pmakode-akamai changed the title Use sessionStorage for codeVerifier and nonce: update OAuth and storage fix: [PDI-3249] - Use sessionStorage for codeVerifier and nonce: update OAuth and storage Apr 9, 2026
@pmakode-akamai pmakode-akamai self-requested a review April 9, 2026 12:15
@linode-gh-bot
Copy link
Copy Markdown
Collaborator

Cloud Manager UI test results

🔺 1 failing test on test run #2 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
1 Failing901 Passing11 Skipped39m 54s

Details

Failing Tests
SpecTest
object-storage.e2e.spec.tsCloud Manager Cypress Tests→object storage end-to-end tests » can update bucket access

Troubleshooting

Use this command to re-run the failing tests:

pnpm cy:run -s "cypress/e2e/core/objectStorage/object-storage.e2e.spec.ts"

Copy link
Copy Markdown
Contributor

@abailly-akamai abailly-akamai left a comment

Choose a reason for hiding this comment

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

I think this is a good approach - am not seeing any regression from my initial testing and this def addresses the multiple tab issue.

This fixes an edge case with multiple tabs session expiration, however we will still have to decide it that's a fix worth introducing. It appears safe but it will have to be tested well. thanks @mkaminsk-akamai

const codeVerifier = storage.authentication.codeVerifier.get();

if (!codeVerifier) {
alert('No code codeVerifier found in local storage when running OAuth callback.');
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.

I don't think this is needed

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.

I don't think this is needed

Yes, I left it so it helps debugging it locally with multiple tabs

@pmakode-akamai pmakode-akamai added the Bug Fixes for regressions or bugs label Apr 10, 2026
@pmakode-akamai pmakode-akamai marked this pull request as ready for review April 10, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Fixes for regressions or bugs

Projects

Status: Review

Development

Successfully merging this pull request may close these issues.

4 participants