fix(swift-sdk): remove productId prefix from BLAuthClient keychain keys

BLAuthClient stored tokens as '{productId}_access_token' but all app
wrappers use KeychainHelper.read(key: "access_token") — the bare key.
This caused a critical mismatch: after login, BlobService/LicenseService
could not find the token, and token migration from UserDefaults was invisible
to BLAuthClient.isAuthenticated.

The Keychain service name (bundleId) already namespaces per product,
making the productId prefix redundant. Now uses bare 'access_token' and
'refresh_token' keys matching existing app conventions.
This commit is contained in:
saravanakumardb1 2026-02-28 22:54:01 -08:00
parent 77d6ff328f
commit b4be39888b

View File

@ -86,11 +86,11 @@ public final class BLAuthClient {
// MARK: - Token Access
public var accessToken: String? {
BLKeychain.read(service: keychainService, key: "\(config.productId)_access_token")
BLKeychain.read(service: keychainService, key: "access_token")
}
public var refreshTokenValue: String? {
BLKeychain.read(service: keychainService, key: "\(config.productId)_refresh_token")
BLKeychain.read(service: keychainService, key: "refresh_token")
}
public var isAuthenticated: Bool {
@ -229,15 +229,15 @@ public final class BLAuthClient {
// MARK: - Private
private func saveTokens(access: String, refresh: String) {
BLKeychain.save(service: keychainService, key: "\(config.productId)_access_token", value: access)
BLKeychain.save(service: keychainService, key: "\(config.productId)_refresh_token", value: refresh)
BLKeychain.save(service: keychainService, key: "access_token", value: access)
BLKeychain.save(service: keychainService, key: "refresh_token", value: refresh)
client.authToken = access
onTokensUpdated?(access)
}
private func clearTokens() {
BLKeychain.delete(service: keychainService, key: "\(config.productId)_access_token")
BLKeychain.delete(service: keychainService, key: "\(config.productId)_refresh_token")
BLKeychain.delete(service: keychainService, key: "access_token")
BLKeychain.delete(service: keychainService, key: "refresh_token")
client.authToken = nil
onTokensUpdated?(nil)
}