Post OAuth Redirect shows the app on its own (with no shopify Ui)

Excursionist
37 3 2

I'm new to OAuth and notice when I send the new app installer to the shopify page to approve the app's scopes, the redirect then goes to the localhost's "/" url without being wrapped inside the shopify admin.

 

But manually navigating to the app admin page will then correctly show the app.

 

What about the code below is causing this?

 

 

 

koa.use(koaSession(koa));

koa.use(shopifyAuth({
  apiKey : SHOPIFY_API_KEY as string
  , secret : SHOPIFY_API_SECRET as string
  , scopes : (AUTH_SCOPES as string).split(","),
  afterAuth(ctx): void {
    ctx.statusCode = 200;
    ctx.redirect('/');
  }
}));

koa.use(verifyRequest());
/* * * * * * * * * * * * * * * * * * * * *
               After Verification
* * * * * * * * * * * * * * * * * * * * */

////// Shopify Api Calls //////
koa.use(async ctx => {
  if (ctx.session === null) {
    console.log(`====ctx.session missing======`);
    return;
  }
});

 

 

0 Likes
Shopify Staff
Shopify Staff
240 32 37

Hey @seandz,

 

You can use the App Bridge for this.

 

The script detects if your app was loaded inside an iframe. If it wasn't, then the script creates a redirection back into the relative embedded URL in the Shopify admin. You can disable this functionality by passing forceRedirect: false as a configuration option.

0 Likes