Shopify

Sign in with Shopify

How a store customer and a FanBase fan become one account, and what that means for a React app.

A fan who already has an account in your store should not have to make another one. Sign in with Shopify lets the store account be the way in.

What it does

The fan signs in to your Shopify store, the way they always have. FanBase is told who they are by Shopify, finds or creates their FanBase account, and signs them in.

It runs on your store's own domain. Shopify vouches for the customer, so FanBase never sees a password.

It is set up per store by the FanBase team with your admin. There is nothing to install from code.

How accounts are matched

When a customer signs in this way for the first time, FanBase has to decide whose account they get.

The customer's emailThey get
Belongs to an existing FanBase accountThat account, with its points, level and history
Is new to FanBaseA new account with that email

After the first time, the store account and the FanBase account are tied together, and the email is no longer consulted.

This is what makes purchase rewards work without thought. A fan who signs in with their store account is, by construction, buying with the email FanBase knows.

In a React app

The SDK has no Shopify login. loginWithToken accepts four providers:

ProviderValue
Googlegoogle
Discorddiscord
Xtwitter
Twitchtwitch

There is no shopify value, and passing one does not work. Fan sign-in covers the four that do.

So on a React site, fans sign in with one of those. Their purchases are still rewarded, because orders are matched by email and not by how the fan signed in. The one thing to tell fans is to shop with the same email they play with.

Sign in with Shopify happens on the Shopify storefront. A session started there belongs to the storefront and does not carry over into a separate React app.

On the storefront

In build

Storefront blocks go one step further. A customer who is logged in to your store is signed in to FanBase without pressing anything: no button, no second login, no redirect. The blocks on the page pick it up.

Two things happen later than you might expect, on purpose:

  • Choosing a username. A new fan is asked for one the first time they do something, like completing a quest. Browsing asks for nothing.
  • Joining the community. Signing in does not join. The fan's first action does, in the same press.

It will depend on how your store handles logins

One change to account matching arrives with the storefront release. Shopify has two kinds of customer account, and they prove different things.

Your store usesA customer proves their email byFanBase will match by email
New customer accountsA one-time code sent to itYes
Classic customer accountsNothing. They choose a password.No

On classic accounts anyone can register with any address, so the address proves nothing, and FanBase will not hand over an existing account on the strength of it. A customer on a classic store will get a FanBase account of their own, tied to their store account.

The practical effect on a classic store: a fan who already plays in your community will start fresh when they sign in through the store.

If your store is still on classic customer accounts, switching to new customer accounts in your Shopify settings is what will make store sign-in and community accounts line up. Your FanBase contact can check which your store uses.

Checklist

  • No code calls loginWithToken with a Shopify provider
  • A React app offers at least one of the four providers
  • Fans are told to shop with the email they play with
  • Before adding storefront blocks, you know whether your store uses new or classic customer accounts

On this page