Skip to content

rename expiresIn to expiresAt and Telemetry to Auth0ClientInfo#1114

Merged
utkrishtsahu merged 1 commit intodevelop/v3.0from
SDK-7908-Rename-credential-properties-and-telemetry
Mar 11, 2026
Merged

rename expiresIn to expiresAt and Telemetry to Auth0ClientInfo#1114
utkrishtsahu merged 1 commit intodevelop/v3.0from
SDK-7908-Rename-credential-properties-and-telemetry

Conversation

@utkrishtsahu
Copy link
Copy Markdown

  • 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

Renames credential properties and internal telemetry infrastructure to align with Android, Flutter, React Native, and Go Auth0 SDKs.

expiresIn → expiresAt

  • Renamed the expiresIn property to expiresAt on Credentials, APICredentials, and SSOCredentials.
  • The JSON wire format key ("expires_in") is unchanged — only the CodingKeys case name changed, the raw string value remains "expires_in".
  • The NSSecureCoding Keychain storage key remains "expiresIn" for backward compatibility with existing stored credentials.
  • Updated all internal usage in CredentialsManager (expiry checks, TTL calculations, doc comments) and Authentication (doc comment code examples).

Telemetry → Auth0ClientInfo

  • Renamed the Telemetry struct to Auth0ClientInfo.
  • Renamed the telemetry property to auth0ClientInfo on the Trackable protocol and all conforming types: Auth0Authentication, Auth0WebAuth, Auth0MFAClient, Auth0MyAccount, Auth0MyAccountAuthenticationMethods, and Request.
  • Renamed source file Telemetry.swift → Auth0ClientInfo.swift and test file TelemetrySpec.swift → Auth0ClientInfoSpec.swift.
  • The Trackable protocol name is unchanged.
  • Internal method names (addTelemetryHeader, queryItemsWithTelemetry) are unchanged as they describe HTTP behavior, not the type.

Documentation

  • Updated V3_MIGRATION_GUIDE.md — added expiresIn→expiresAt and Telemetry→Auth0ClientInfo to the Renamed APIs table with migration examples.
  • Updated EXAMPLES.md — ssoCredentials.expiresIn → ssoCredentials.expiresAt in SSO code examples.
  • Updated project.pbxproj — all file references and group names.

📎 References

SDK-7908

🎯 Testing

Build passed.
UT passed.

@utkrishtsahu utkrishtsahu requested a review from a team as a code owner March 10, 2026 04:28
@NandanPrabhu
Copy link
Copy Markdown
Contributor

@utkrishtsahu with this PR lets try to add user agent to MFA and my account APIs

Copy link
Copy Markdown

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 aligns the Swift SDK’s public API and internal “Auth0-Client” header infrastructure with other Auth0 SDKs by renaming credential expiry properties (expiresInexpiresAt) and renaming the telemetry type (TelemetryAuth0ClientInfo), plus updating docs/tests/project references accordingly.

Changes:

  • Renamed expiresIn to expiresAt across Credentials, APICredentials, and SSOCredentials while keeping the expires_in JSON key and maintaining Keychain backward compatibility for stored Credentials.
  • Renamed Telemetry to Auth0ClientInfo and updated Trackable/clients/requests to use auth0ClientInfo.
  • 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

  • Auth0ClientInfo is public, but enabled/info/value are 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 public enabled flag. Consider making the relevant properties (at least enabled, and any others intended for public use) public to 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 be generateEnvironment). 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.

Comment on lines 109 to 121
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
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@utkrishtsahu please resolve this

@sanchitmehtagit
Copy link
Copy Markdown
Contributor

sanchitmehtagit commented Mar 10, 2026

#1114 (comment)
Nandan has 1 suggestion, we could keep the scope of this PR limited to just the rename. it easier and cleaner for review I had created a similar item in the iOS tech debt backlog to add the missing instrumentation in the code. If you’d like, you can pick it up in the next sprint. We can raise it against master.
I have approved it from my side. lmk @NandanPrabhu if you are ok with this!

@sanchitmehtagit sanchitmehtagit added Swift v3.0 This label depicts this feature is part of Swift 3.0 review:medium Medium review labels Mar 10, 2026
@utkrishtsahu utkrishtsahu merged commit 105aff7 into develop/v3.0 Mar 11, 2026
16 checks passed
@utkrishtsahu utkrishtsahu deleted the SDK-7908-Rename-credential-properties-and-telemetry branch March 11, 2026 05:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:medium Medium review Swift v3.0 This label depicts this feature is part of Swift 3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants