OAuth Providers
Logo for shopifyShopify
Obtain access tokens to Shopify accounts with Handshake.

How it works

With your instance deployed, redirect users to:

https://YOUR_HANDSHAKE_INSTANCE_URL/auth/HANDLER_ID/redirect

Where HANDLER_ID is either shopify or the value passed to the optional id argument of the Shopify() factory. (See Options below.)

Handshake will take each user through the Shopify OAuth flow and before sending them back to you, at the URL specified by the callback_uri query parameter.

For Shopify, you must include an extras.shop parameter to identify the shop that you're trying to take through the OAuth flow. The final URL might look something like this:

https://YOUR_HANDSHAKE_INSTANCE_URL/auth/shopify/redirect?
  state=12345
  &extras.shop=example.myshopify.com
  &callback_uri=http://YOUR_APP_URL/shopify-integration/done # example

Options

Modify your app/options.ts file to include the Shopify() handler like so:

app/options.ts
import { HandshakeOptions, Shopify } from "handshake";
 
const options: HandshakeOptions = {
  handles: [
    Shopify({
      clientId: process.env.SHOPIFY_CLIENT_ID!,
      clientSecret: process.env.SHOPIFY_CLIENT_SECRET!,
      scopes: ["read_orders", "read_products"],
    }),
  ],
};
 
// ...

Consult the reference to learn about HandshakeOptions.


Provider setup

The clientId and clientSecret arguments to the Shopify() handler come from your Shopify app.

1. Create a Shopify app

You must have a Shopify app to take users through the OAuth flow. Check out this in-depth tutorial on how authentication works in the Shopify ecosystem.

Within your app, you'll find the client ID and secret:

Find client ID and secret in the admin of your Shopify
app.

Find client ID and secret in the admin of your Shopify app.

2. Configure the Callback URL

Make sure your Handshake URL is allowed within your Shopify app's Configuration tab:

Follow the format: https://HANDSHAKE_URL/auth/shopify/callback


Troubleshooting

"The redirect_uri is not whitelisted"

If you see this, the Handshake callback URL you asked Shopify to send users back to wasn't added to the list of allowed URLs in your Shopify app settings.

Shopify error page saying "The redirect_uri is not
whitelisted"

Shopify error page saying "The redirect_uri is not whitelisted"


Facing an issue not included here? Open an issue on GitHub to get help.