-
Notifications
You must be signed in to change notification settings - Fork 254
Handle concurrency for credential renewal scenarios. #1039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
sanchitmehta94
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// 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 { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
sanchitmehta94
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sanchitmehta94
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sanchitmehta94
left a comment
There was a problem hiding this 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 */; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📋 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