Implement Automatic Login

The Auto Login component detects when a shopper has an active Bolt session and skips the detect account and authorization modal steps, sending the shopper directly to the payment step.

Even though an active Bolt session skips the shopper to the payment step, you must implement all steps.

1. Create and Mount the Authorization Modal

Mounting the authorization modal will attach the iframe to your site’s DOM, but will not render it. You must pass the Bolt Publishable Key to create the modal. Replace YOUR_KEY with your Publishable Key in the example below.

async function mountAuthorizationComponent(){
  const boltPublishableKey = YOUR_KEY
  const boltEmbedded = Bolt(boltPublishableKey);

  const authorizationComponent = boltEmbedded.create("authorization_component",  {style: {position: "right"}} );
  await authorizationComponent.mount(".email-div") // mount on the div container
}

2. Call Authorize Function

This function checks for an active Bolt session and triggers auto-login, which skips the detect account and authorize account steps for the shopper.

let authorizationResponse = await authorizeComponent.authorize({});
Active Bolt Session Detected Result Next Step in Flow
Yes Returns a promise that resolves to a JSON object with the keys, authorizationCode, and scope. Payment Fields
No Returns a promise that resolves to an undefined value Detect Bolt Account

Next Step

After you implement Auto Login, you will enable Bolt Account Detection to check Bolt account data to determine whether an account exists for inputted shopper identification.

πŸ“–On This Page