diff --git a/packages/shopify-app-remix/src/server/authenticate/admin/authenticate.ts b/packages/shopify-app-remix/src/server/authenticate/admin/authenticate.ts index e34a97a0e4..fea7af692e 100644 --- a/packages/shopify-app-remix/src/server/authenticate/admin/authenticate.ts +++ b/packages/shopify-app-remix/src/server/authenticate/admin/authenticate.ts @@ -35,7 +35,7 @@ import { redirectFactory, redirectToShopifyOrAppRoot, } from './helpers'; -import {AuthCodeFlowStrategy} from './strategies/auth-code-flow'; +import {AuthorizationStrategy} from './strategies/types'; const SESSION_TOKEN_PARAM = 'id_token'; @@ -45,14 +45,14 @@ interface ShopWithSessionContext { } interface AuthStrategyParams extends BasicParams { - strategy: AuthCodeFlowStrategy; + strategy: AuthorizationStrategy; } export class AuthStrategy< Config extends AppConfigArg, Resources extends ShopifyRestResources = ShopifyRestResources, > { - protected strategy: AuthCodeFlowStrategy; + protected strategy: AuthorizationStrategy; protected api: Shopify; protected config: AppConfig; protected logger: Shopify['logger']; diff --git a/packages/shopify-app-remix/src/server/authenticate/admin/strategies/auth-code-flow.ts b/packages/shopify-app-remix/src/server/authenticate/admin/strategies/auth-code-flow.ts index 8f1efe6060..144a2d85fc 100644 --- a/packages/shopify-app-remix/src/server/authenticate/admin/strategies/auth-code-flow.ts +++ b/packages/shopify-app-remix/src/server/authenticate/admin/strategies/auth-code-flow.ts @@ -21,9 +21,12 @@ import { import {SessionContext} from '../types'; import {AppConfig} from '../../../config-types'; +import {AuthorizationStrategy} from './types'; + export class AuthCodeFlowStrategy< Resources extends ShopifyRestResources = ShopifyRestResources, -> { +> implements AuthorizationStrategy +{ protected api: Shopify; protected config: AppConfig; protected logger: Shopify['logger']; diff --git a/packages/shopify-app-remix/src/server/authenticate/admin/strategies/types.ts b/packages/shopify-app-remix/src/server/authenticate/admin/strategies/types.ts new file mode 100644 index 0000000000..9b466b40a6 --- /dev/null +++ b/packages/shopify-app-remix/src/server/authenticate/admin/strategies/types.ts @@ -0,0 +1,11 @@ +import {SessionContext} from '../types'; + +export interface AuthorizationStrategy { + handleRoutes: (request: Request) => void; + manageAccessToken: ( + sessionContext: SessionContext | undefined, + shop: string, + request: Request, + ) => Promise; + ensureInstalledOnShop: (request: Request) => void; +}