Overview
The Bolt iOS SDK provides a built-in SSO flow that lets users log in with their Bolt account using OAuth 2.0, and optionally PKCE. After login, you receive an authorization code and state that your backend exchanges for an access token.If you don’t have a backend application and need to exchange the authorization code directly from your mobile app, enable PKCE mode and send the authorization code, state, and code verifier to the Bolt token exchange endpoint.
Completion Handler
Delegate Pattern
ImplementBoltLoginDelegate for callback-based results:
View Controller (Explicit Presentation)
PKCE Mode
By default, the SDK does not include a PKCE code challenge in the authorization request. If your integration exchanges the authorization code directly from the client, enable PKCE:usePkce is false (default), no code_challenge is sent and codeVerifier in the callback will be an empty string.
How It Works
startLogin()opens a WebView with the Bolt-hosted login page. Your app does not pass an email: the user enters it directly on the page.- (PKCE flow only) The SDK generates a PKCE code verifier and code challenge automatically.
- The user enters their Bolt account email. Bolt sends a one-time passcode (OTP) via email or SMS: the user picks their preferred delivery method and enters the code.
- On success, the hosted page redirects with an authorization code.
- The SDK intercepts this redirect inside the WebView: no URL scheme configuration in your app is required.
onLoginSuccess(authCode:codeVerifier:state:)is called.
Backend Token Exchange
WhenonLoginSuccess fires, send authCode to your backend immediately. Your backend exchanges it for an access token:
Logout
To log the user out of their Bolt session:SFCC Integration
Some merchants use Salesforce Commerce Cloud (SFCC) as their e-commerce platform and have configured Bolt as an OAuth identity provider within SFCC. In this setup, the token exchange does not go directly to Bolt’s/v1/oauth/token endpoint. Instead, the Bolt authorization code and state are forwarded to SFCC, which handles the token exchange server-to-server on your behalf.
In the SFCC flow, you should not use PKCE as the token exchange is made from your backend.