Skip to content

Conversation

@sanchitmehta94
Copy link
Contributor

@sanchitmehta94 sanchitmehta94 commented Dec 11, 2025

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

📋 Changes

More context here: https://oktawiki.atlassian.net/wiki/spaces/DXSDK/pages/2883787251/Next+major+of+Auth0.swift+Non-breaking+changes#1.-Make-credenti[%E2%80%A6]rrency-scenarios

This should fix : auth0/react-native-auth0#1374

https://github.com/auth0/Auth0.swift/blob/889e87357732335804a19c98001337645afb8e6d/Documentation.docc/RefreshTokens.md?plain=1

As per above doc if Devs are calling the Authenticatiin renewAPI() they have to take care of synchronisation but with this PR renewAPI would alos execute one request at a time and will be thread safe

📎 References

🎯 Testing

@sanchitmehta94 sanchitmehta94 self-assigned this Dec 11, 2025
Copy link
Contributor Author

@sanchitmehta94 sanchitmehta94 left a comment

Choose a reason for hiding this comment

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

@sanchitmehta94 sanchitmehta94 changed the title Handle concurrency for credential renewal scenarios. Handle concurrency for credential renewal scenarios. (Test cases pending) Dec 11, 2025
/// Internal utility for synchronizing operations across CredentialsManager instances
/// and the Authentication API client. This ensures that only one operation is
/// in flight at a time, preventing concurrency issues when Refresh Token Rotation is enabled.
final class SynchronizationBarrier {
Copy link
Contributor

Choose a reason for hiding this comment

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

there is a Queue barrier used in web auth. can we try to use the same? in web view also its used to block a duplicate transaction

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Purpose is different. that was added for preventing ASWebAuthentication crash.
This is more for synchornising requests for renewal in concurrent conditions. https://oktawiki.atlassian.net/wiki/spaces/DXSDK/pages/2883787251/Next+major+of+Auth0.swift+Non-breaking+changes#1.-Make-credenti[%E2%80%A6]rrency-scenarios

Copy link
Contributor Author

@sanchitmehta94 sanchitmehta94 left a comment

Choose a reason for hiding this comment

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

@sanchitmehta94 sanchitmehta94 marked this pull request as ready for review December 12, 2025 11:39
@sanchitmehta94 sanchitmehta94 requested a review from a team as a code owner December 12, 2025 11:39
@sanchitmehta94 sanchitmehta94 changed the title Handle concurrency for credential renewal scenarios. (Test cases pending) Handle concurrency for credential renewal scenarios. [DO NOT REVIEW] Dec 12, 2025
Copy link
Contributor Author

@sanchitmehta94 sanchitmehta94 left a comment

Choose a reason for hiding this comment

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

@sanchitmehta94 sanchitmehta94 changed the title Handle concurrency for credential renewal scenarios. [DO NOT REVIEW] Handle concurrency for credential renewal scenarios. Dec 12, 2025
@sanchitmehta94 sanchitmehta94 marked this pull request as draft December 12, 2025 11:55
Copy link
Contributor Author

@sanchitmehta94 sanchitmehta94 left a comment

Choose a reason for hiding this comment

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

6287D5C92EE30033001E1651 /* OSUnifiedLoggingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6287D5C62EE30033001E1651 /* OSUnifiedLoggingService.swift */; };
6287D5CA2EE30033001E1651 /* OSUnifiedLoggingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6287D5C62EE30033001E1651 /* OSUnifiedLoggingService.swift */; };
6287D5CB2EE30033001E1651 /* OSUnifiedLoggingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6287D5C62EE30033001E1651 /* OSUnifiedLoggingService.swift */; };
62BD27002EEA928F001FC67C /* SynchronizationBarrier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62BD26FF2EEA928F001FC67C /* SynchronizationBarrier.swift */; };
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Users getting logged out with "Unsuccessful Refresh Token exchange, reused refresh token detected"

3 participants