This guide shows how to implement social logins with the Turnkey Swift SDK.
The SDK launches the provider in the system browser, retrieves an OIDC token, and (by default) completes login or signup through the Auth Proxy. The examples below use SwiftUI, but the SDK works with any Swift framework.Turnkey supports any OIDC provider. The SDK provides convenience helpers for popular providers (Google, Apple, Discord, X).
For other providers, run your own OAuth flow to obtain an OIDC token and complete authentication with completeOAuth(oidcToken:publicKey:...).Before you begin:
If you pass onOAuthSuccess, the helper returns early with the oidcToken and the publicKey associated with the session.
You can then call completeOAuth(...) yourself (for example, to customize sessionKey or sub-organization creation).
If you already obtained an OIDC token from your own OAuth flow, call completeOAuth(oidcToken:publicKey:...) to finish authentication via the Auth Proxy.
The publicKey must match the key used to compute the nonce included in the
OIDC token.
Copy
Ask AI
let result = try await turnkey.completeOAuth( oidcToken: "<oidc_token_from_provider>", publicKey: "<matching_public_key>", sessionKey: "main")// result.session is stored automatically when completeOAuth succeeds
For more information, refer to the Social Logins guide.