Commit d44f8c06 authored by Ilya Vysotski's avatar Ilya Vysotski
Browse files

Add the ability to specify the host

parent d5bff4f9
......@@ -3,10 +3,12 @@ import querystring from 'querystring';
import {Context} from 'koa';
import redirectionPage from './redirection-page';
import getHost from 'src/lib/get-host';
export default function createTopLevelRedirect(apiKey: string, path: string) {
return function topLevelRedirect(ctx: Context) {
const {host, query} = ctx;
const host = getHost(ctx);
const {query} = ctx;
const {shop} = query;
const params = {shop};
......
......@@ -6,6 +6,7 @@ import nonce from 'nonce';
import {OAuthStartOptions} from '../types';
import getCookieOptions from './cookie-options';
import getHost from 'src/lib/get-host';
const createNonce = nonce();
......@@ -14,7 +15,8 @@ export default function oAuthQueryString(
options: OAuthStartOptions,
callbackPath: string,
) {
const {host, cookies} = ctx;
const host = getHost(ctx);
const {cookies} = ctx;
const {scopes = [], apiKey, accessMode} = options;
const requestNonce = createNonce();
......
import { Context } from 'koa';
export default function getHost(ctx: Context) {
console.log({koaShopifyAuthEnv: process.env});
const {
SHOPIFY_APP_HOST
} = process.env;
return SHOPIFY_APP_HOST || ctx.host;
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment