How to use the @shopify/koa-shopify-auth.default function in @shopify/koa-shopify-auth

To help you get started, we’ve selected a few @shopify/koa-shopify-auth examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DimensionSoftware / generator-shopify-nextjs / generators / app / templates / server.js View on Github external
.then(() => {
    const server = new Koa()
    const router = new Router()
    server.keys = [ process.env.SERVER_SECRET ]
    server
      .use(session(server))
      .use(shopifyAuth({
        // if specified, mounts the routes off of the given path
        // eg. /shopify/auth, /shopify/auth/callback
        // defaults to ''
        prefix: '/shopify',
        // your shopify app api key
        apiKey: process.env.SHOPIFY_API_KEY,
        // your shopify app secret
        secret: process.env.SHOPIFY_SECRET,
        // scopes to request on the merchants store
        scopes: ['write_orders, write_products'],
        // callback for when auth is completed
        afterAuth(ctx) {
          // add/install shop
          const
            {shop, accessToken} = ctx.session,
            client = initApollo()
github Shopify / shopify-demo-app-node-react / server.js View on Github external
app.prepare().then(() => {
  const server = new Koa();
  const router = new Router();
  server.use(session(server));
  server.keys = [SHOPIFY_API_SECRET_KEY];

  server.use(
    createShopifyAuth({
      apiKey: SHOPIFY_API_KEY,
      secret: SHOPIFY_API_SECRET_KEY,
      scopes: ['read_products', 'write_products'],
      async afterAuth(ctx) {
        const { shop, accessToken } = ctx.session;
        ctx.cookies.set("shopOrigin", shop, { httpOnly: false });

        const registration = await registerWebhook({
          address: `${HOST}/webhooks/products/create`,
          topic: 'PRODUCTS_CREATE',
          accessToken,
          shop,
          apiVersion: ApiVersion.October19
        });

        if (registration.success) {

@shopify/koa-shopify-auth

Middleware to authenticate a Koa application with Shopify

MIT
Latest version published 2 years ago

Package Health Score

47 / 100
Full package analysis

Similar packages