rename expiresIn to expiresAt and Telemetry to Auth0ClientInfo#1114
Conversation
|
@utkrishtsahu with this PR lets try to add user agent to MFA and my account APIs |
There was a problem hiding this comment.
Pull request overview
This PR aligns the Swift SDK’s public API and internal “Auth0-Client” header infrastructure with other Auth0 SDKs by renaming credential expiry properties (expiresIn → expiresAt) and renaming the telemetry type (Telemetry → Auth0ClientInfo), plus updating docs/tests/project references accordingly.
Changes:
- Renamed
expiresIntoexpiresAtacrossCredentials,APICredentials, andSSOCredentialswhile keeping theexpires_inJSON key and maintaining Keychain backward compatibility for storedCredentials. - Renamed
TelemetrytoAuth0ClientInfoand updatedTrackable/clients/requests to useauth0ClientInfo. - Updated migration guide, examples, tests, and Xcode project references for the new names.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| V3_MIGRATION_GUIDE.md | Documents the API renames and provides migration examples. |
| EXAMPLES.md | Updates SSO cookie examples to use expiresAt. |
| Auth0Tests/WebAuthSpec.swift | Updates WebAuth tests for Auth0ClientInfo and expiresAt. |
| Auth0Tests/SSOCredentialsSpec.swift | Updates SSO credentials tests to expiresAt. |
| Auth0Tests/Responses.swift | Renames test response helper parameter to expiresAt. |
| Auth0Tests/RequestSpec.swift | Updates request construction to pass Auth0ClientInfo. |
| Auth0Tests/MyAccount/AuthenticationMethods/MyAccountAuthenticationMethodsSpec.swift | Updates MyAccount tests for Auth0ClientInfo. |
| Auth0Tests/CredentialsSpec.swift | Updates credentials tests to expiresAt. |
| Auth0Tests/CredentialsManagerSpec.swift | Updates credentials manager tests for expiresAt and response helpers. |
| Auth0Tests/BiometricPolicySpec.swift | Updates biometric policy test credentials to expiresAt. |
| Auth0Tests/AuthenticationSpec.swift | Updates authentication tests for Auth0ClientInfo. |
| Auth0Tests/Auth0ClientInfoSpec.swift | Renames and updates telemetry tests for Auth0ClientInfo. |
| Auth0Tests/APICredentialsSpec.swift | Updates API credentials tests to expiresAt. |
| Auth0/WebAuth.swift | Renames telemetry property to auth0ClientInfo in the public WebAuth protocol. |
| Auth0/SSOCredentials.swift | Renames expiresIn to expiresAt with expires_in coding key unchanged. |
| Auth0/Request.swift | Renames request telemetry storage/use to auth0ClientInfo and keeps adding Auth0-Client header. |
| Auth0/MyAccount/AuthenticationMethods/Auth0MyAccountAuthenticationMethods.swift | Propagates auth0ClientInfo through MyAccount Authentication Methods requests. |
| Auth0/MyAccount/Auth0MyAccount.swift | Propagates auth0ClientInfo through MyAccount client. |
| Auth0/MFA/Auth0MFAClient.swift | Propagates auth0ClientInfo through MFA client requests. |
| Auth0/CredentialsManager.swift | Updates expiry checks to use expiresAt and keeps SSO cookie docs consistent. |
| Auth0/Credentials.swift | Renames property to expiresAt, keeps JSON key expires_in and NSSecureCoding key compatibility. |
| Auth0/Authentication.swift | Updates documentation example to ssoCredentials.expiresAt. |
| Auth0/Auth0WebAuth.swift | Updates WebAuth implementation to use auth0ClientInfo in authorize URL and Authentication client. |
| Auth0/Auth0ClientInfo.swift | Renames Telemetry type/protocol property and retains header/query-item behavior. |
| Auth0/Auth0Authentication.swift | Propagates auth0ClientInfo through Authentication client request creation. |
| Auth0/APICredentials.swift | Renames property to expiresAt and keeps coding key expires_in. |
| Auth0.xcodeproj/project.pbxproj | Renames file/group references from Telemetry to Auth0ClientInfo. |
| AppTests/ContentViewModelTests.swift | Updates app test mock Authentication to use auth0ClientInfo. |
Comments suppressed due to low confidence (3)
Auth0/Auth0ClientInfo.swift:18
Auth0ClientInfoispublic, butenabled/info/valueare currently internal. This prevents SDK consumers from using the documented migration example (auth.auth0ClientInfo.enabled = false) and likely breaks existing usage that previously toggled telemetry via a publicenabledflag. Consider making the relevant properties (at leastenabled, and any others intended for public use)publicto preserve the expected API surface.
Auth0Tests/Auth0ClientInfoSpec.swift:152- In this "auth0ClientInfo query item" section, the
it(...)descriptions still say "header" even though the assertions are about query items. Updating the test descriptions would make the intent clearer and avoid confusion when reading failures.
Auth0/Auth0ClientInfo.swift:67 generateEnviroment()is misspelled (should begenerateEnvironment). Since it’s only referenced within this file, consider renaming the method and its call sites to improve readability and avoid propagating the typo.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| func authResponse(accessToken: String, | ||
| tokenType: String = "bearer", | ||
| issuedTokenType: String? = nil, | ||
| idToken: String, | ||
| refreshToken: String? = nil, | ||
| expiresIn: Double = 3600, | ||
| expiresAt: Double = 3600, | ||
| scope: String? = nil, | ||
| recoveryCode: String? = nil) -> RequestResponse { | ||
| var json = [ | ||
| "access_token": accessToken, | ||
| "token_type": tokenType, | ||
| "expires_in": String(expiresIn), | ||
| "expires_in": String(expiresAt), | ||
| "id_token": idToken |
There was a problem hiding this comment.
The helper is emitting the OAuth expires_in field (a TTL in seconds), but the parameter was renamed to expiresAt and remains a Double. This name is misleading (it reads like an absolute timestamp); consider renaming it to something like expiresIn/expiresInSeconds to match the payload semantics and reduce confusion in tests.
|
#1114 (comment) |
📋 Changes
Renames credential properties and internal telemetry infrastructure to align with Android, Flutter, React Native, and Go Auth0 SDKs.
expiresIn → expiresAt
Telemetry → Auth0ClientInfo
Documentation
📎 References
SDK-7908
🎯 Testing
Build passed.
UT passed.