iOS and macOS SDK
Sign end users in through the hosted login from Swift apps, with PKCE, Keychain storage and passkeys.
A Swift package for iOS 15+ and macOS 12+, with no dependencies.
Install
Section titled “Install”// Swift Package Manager.package(url: "https://github.com/ohauthcat/sdk-swift.git", exact: "0.0.2")
// CocoaPodspod "OhAuthCat", "0.0.2"- Configure with
Configuration(and create anloginOrigin: https: / / login. ohauthcat. com, clientID: "pk_…", redirectURI: com. example. app: / oauth/ callback) OhAuthCatClientwith aSystemWebAuthenticator. signIn()opens the hosted login inASWebAuthenticationSessionwith PKCE (S256),stateandnonce. The callback must match the redirect URI exactly, and anyissin it must be the configured issuer.- Tokens are kept in the Keychain, on this device only and never synced.
accessToken()refreshes once for all concurrent callers. If the server reports a reused refresh token, the session is cleared.signOut()clears the local session and, in OAuth provider mode, revokes the refresh token.switchOrganization(_:)runs the hosted login again withorganization_id.- Use
mode: .to sign in against the environment’s OAuth provider instead, for scopes and revocation.oauth( environmentID: ) - Passkeys inside the app go through a
Passkeys(seam; the hosted login already offers passkeys in the browser session.backend: authenticator: )
The SDK checks the ID token’s claims but not its signature, since it comes directly from the token endpoint over TLS. Your backend must verify access tokens against the JWKS.