Skip to content

Support functions for provider.auth and provider.token #461

@charlesbjohnson

Description

@charlesbjohnson

Support plan

  • which support plan is this issue covered by? (e.g. Community, Core, Plus, or Enterprise): Community
  • is this issue currently blocking your project? (yes/no): no
  • is this issue affecting a production system? (yes/no): no

Context

  • node version: latest
  • module version: latest
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): @hapi/hapi@latest
  • any other relevant information: n/a

What problem are you trying to solve?

I'm attempting to use this module in a Shopify app that integrates with Shopify's OAuth2 authentication workflow.

Shopify works slightly differently from the current providers in that the authorization step is per store, such that the provider.auth and provider.token options differ depending on the store that initiated the OAuth flow (AKA the store that installed the "app").

In other words, in order for "Store A" authenticate it must redirect to https://store-a.myshopify.com/admin/oauth/authorize, while a "Store B" must redirect to https://store-b.myshopify.com/admin/oauth/authorize.

Do you have a new or modified API suggestion to solve the problem?

As far as I can tell, @shopify/koa-shopify-auth is able to determine which store to redirect to through a query parameter in the request. I think a similar approach could be taken here.

Would you support expanding the provider schema so that auth and token options can alternatively accept functions with access to request, similar to the providerParams or scope options (#233)?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew functionality or improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions