SSO Login
Configure single-sign on for your iOS app to carry over a login session to the checkout flow.

After you’ve successfully set up the Bolt iOS SDK and payment provider, you can add SSO login capabilities. With this feature, you no longer need to maintain a login session.

Instead, this feature enables a session that automatically carries over to the checkout flow.

Before You Start

Before you start, you must configure your app to:

  1. Migrate shopper accounts to Bolt Accounts by enabling SSO Commerce.
  2. Include a login button to present the SSO login page.

Set Up

To set up SSO login on your iOS app, you’ll need to:

  1. First create a configuration with your Bolt Publishable Key. You can find your Bolt Publishable Key in your Merchant Dashboard. Go to Administration > API. The publishable key is a long string of lower and upper case letters and numbers that consists of three sections. publishable key
  2. Present the SSO Login View.
  3. Retrieve the Access Token from your store server.

Create a BoltCheckout Instance

First, create a configuration with your publishable key. This is required to create a SSO login url within the SDK.

 // Create a BoltCheckout with your publishable key
      let checkout = BoltCheckout(publishableKey: publishableKey, environment:  .production)

Present SSO Login View

When a shopper taps the login button, startLogin is called to display the SSO login web page in full screen. When the login process is complete, the app receives a BoltSSOLoginResult notification. Upon a successful login, the view is dismissed and an authorization code is returned to your app.

checkout.startLogin(presentingViewController: self) { result in
  switch result {
  case .completed(let authorizationCode):
    // Do your own handling with authorization code returned
    print("login succeeded with auth code: ", authorizationCode)
  case .canceled:
    print("login canceled")
  case .failed(let error):
    print("login failed with error: ", error.localizedDescription)

Retrieve Access Token

After your app receives the authorization code from the completion block of startLogin, send the authorization code to your store server (/oauth/token) to exchange the authorization code for an access token.

Filter by Section
Filter by Topic