refactor: Align nonce computation with other mobile SDKs#1118
Merged
NandanPrabhu merged 8 commits intomasterfrom Mar 18, 2026
Merged
refactor: Align nonce computation with other mobile SDKs#1118NandanPrabhu merged 8 commits intomasterfrom
NandanPrabhu merged 8 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates Auth0WebAuth to persist and propagate state/nonce values through the web auth flow (including authorize URL construction and ID token validation), and adjusts the test suite accordingly.
Changes:
- Generate and store default
stateandnonceinAuth0WebAuth.parameterswhen missing. - Thread
noncethroughstart()intobuildAuthorizeURL(...), and pass it into the PKCE handler for ID token validation. - Update
WebAuthSpecto exercise the new nonce/state behavior and to pass a nonce intobuildAuthorizeURL(...)in URL-building tests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| Auth0/Auth0WebAuth.swift | Adds cached generation for state/nonce, threads nonce into authorize URL building, and uses nonce for PKCE/ID token validation. |
| Auth0Tests/WebAuthSpec.swift | Updates authorize URL tests and adds/adjusts expectations around state/nonce generation and persistence. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…generated everytime
(cherry picked from commit 9cee5402bf20e6210d4cfcfdcf506b3bc30aab7d)
sanchitmehtagit
previously approved these changes
Mar 17, 2026
Contributor
sanchitmehtagit
left a comment
There was a problem hiding this comment.
LGTM, Could we please add context/background too on PR description and better PR title
sanchitmehtagit
approved these changes
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 Changes
Nonce computation is refactored to match other SDKs in following steps
func nonce(_ nonce: String) -> SelfofWebAuthfunc parameters(_ parameters: [String: String]) -> Self📎 References
🎯 Testing
Unit tests updated to add coverage for code for nonce computation refactoring