Implement IAM Login Operations (#7439)

* ci: announce modifications in the SDK API feed (#7451)

An attribute-only modification is neither an addition nor a break, so it reached the feed as a headline and a link, with the headline claiming new API.

* Implement the IAM network operations

# Conflicts:
#	RevenueCat.xcodeproj/project.pbxproj

# Conflicts:
#	RevenueCat.xcodeproj/project.pbxproj

* target membership

# Conflicts:
#	RevenueCat.xcodeproj/project.pbxproj

* fix test

* address cursor feedback

* fix imports

* revert fetch policy

* missed one

---------

Co-authored-by: Álvaro Brey <alvaro.brey@revenuecat.com>
This commit is contained in:
Dave DeLongandÁlvaro Brey authored and GitHub committed 2026-08-21 14:04:22 -06:00
1 parent 3eb01c32bc
commit 8349a4afd1
26 files changed
+1812 -20

No files matched your search

@@ -189,6 +189,9 @@ extension HTTPRequest {
case rewardVerificationStatus(appUserID: String, clientTransactionID: String)
case remoteConfig(domain: String)
case tokenLogin
case tokenRefresh
case tokenLogOut
}
enum FallbackPath: Hashable {
@@ -285,7 +288,10 @@ extension HTTPRequest.Path: HTTPRequestPath {
.postCreateTicket,
.isPurchaseAllowedByRestoreBehavior,
.rewardVerificationStatus,
.remoteConfig:
.remoteConfig,
.tokenLogin,
.tokenRefresh,
.tokenLogOut:
return true
case .health,
@@ -312,7 +318,10 @@ extension HTTPRequest.Path: HTTPRequestPath {
.appHealthReport,
.postCreateTicket,
.isPurchaseAllowedByRestoreBehavior,
.rewardVerificationStatus:
.rewardVerificationStatus,
.tokenLogin,
.tokenRefresh,
.tokenLogOut:
return true
case .remoteConfig,
.health,
@@ -343,7 +352,10 @@ extension HTTPRequest.Path: HTTPRequestPath {
.postOfferForSigning,
.postRedeemWebPurchase,
.getCustomerCenterConfig,
.postCreateTicket:
.postCreateTicket,
.tokenLogin,
.tokenRefresh,
.tokenLogOut:
return false
}
}
@@ -358,7 +370,10 @@ extension HTTPRequest.Path: HTTPRequestPath {
.appHealthReportAvailability,
.isPurchaseAllowedByRestoreBehavior,
.remoteConfig,
.rewardVerificationStatus:
.rewardVerificationStatus,
.tokenLogin,
.tokenRefresh,
.tokenLogOut:
return true
case .getOfferings,
.getIntroEligibility,
@@ -456,6 +471,15 @@ extension HTTPRequest.Path: HTTPRequestPath {
case let .remoteConfig(domain):
return "config/\(Self.escape(domain))"
case .tokenLogin:
return "/auth/login"
case .tokenRefresh:
return "/auth/token"
case .tokenLogOut:
return "/auth/revoke"
}
}
@@ -506,6 +530,12 @@ extension HTTPRequest.Path: HTTPRequestPath {
return self.pathComponent
case .remoteConfig:
return self.pathComponent
case .tokenLogin:
return "/auth/login"
case .tokenRefresh:
return "/auth/token"
case .tokenLogOut:
return "/auth/revoke"
}
}
@@ -569,6 +599,15 @@ extension HTTPRequest.Path: HTTPRequestPath {
case .remoteConfig:
return "remote_config"
case .tokenLogin:
return "token_login"
case .tokenRefresh:
return "token_refresh"
case .tokenLogOut:
return "token_logout"
}
}
@@ -585,6 +624,14 @@ extension HTTPRequest.Path: HTTPRequestPath {
}
}
var isIAMPath: Bool {
switch self {
case .tokenLogin, .tokenRefresh, .tokenLogOut:
return true
default: return false
}
}
private static func escape(_ appUserID: String) -> String {
return appUserID.trimmedAndEscaped
}