Skip to content

Normalize OAuth API key to handle 0x prefixes#14094

Merged
rickyrombo merged 1 commit intomainfrom
mjp-normalize-oauth-api-key
Apr 10, 2026
Merged

Normalize OAuth API key to handle 0x prefixes#14094
rickyrombo merged 1 commit intomainfrom
mjp-normalize-oauth-api-key

Conversation

@rickyrombo
Copy link
Copy Markdown
Contributor

Summary

  • Strips 0x prefix from api_key/client_id query params at parse time in the OAuth consent hooks
  • Updates isValidApiKey to accept keys with 0x prefix

Test plan

  • Verify OAuth consent flow works with 0x-prefixed API keys
  • Verify OAuth consent flow continues to work with bare hex API keys
  • Verify invalid API keys are still rejected

🤖 Generated with Claude Code

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 10, 2026

⚠️ No Changeset found

Latest commit: 1fcf6c0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@rickyrombo rickyrombo force-pushed the mjp-normalize-oauth-api-key branch from ef15d1c to 6976b4a Compare April 10, 2026 01:23
@pull-request-size pull-request-size bot added size/S and removed size/L labels Apr 10, 2026
Strip 0x prefix from api_key/client_id query params at parse time
and update isValidApiKey to accept prefixed keys, so OAuth consent
works regardless of whether the key includes the prefix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates OAuth client API key handling to be tolerant of 0x-prefixed hex strings by normalizing query params during parsing and broadening API key validation.

Changes:

  • Normalize api_key / client_id query params by stripping a leading 0x during param parsing (web + mobile).
  • Update isValidApiKey (web + mobile) to accept keys with an optional 0x prefix.
  • Keep existing redirect URI validation behavior unchanged.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
packages/web/src/pages/oauth-login-page/utils.ts Accept optional 0x prefix in API key validation.
packages/web/src/pages/oauth-login-page/hooks.ts Strip 0x prefix from parsed OAuth query param API key.
packages/mobile/src/screens/oauth-screen/utils.ts Accept optional 0x prefix in API key validation.
packages/mobile/src/screens/oauth-screen/hooks/useParsedParams.ts Strip 0x prefix from parsed OAuth query param API key.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

🌐 Web preview ready

Preview URL: https://audius-web-preview-pr-14094.audius.workers.dev

Unique preview for this PR (deployed from this branch).
Workflow run

@rickyrombo rickyrombo merged commit c58665c into main Apr 10, 2026
18 checks passed
@rickyrombo rickyrombo deleted the mjp-normalize-oauth-api-key branch April 10, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants