App Bridge v2 required host parameter is missing from the OAuth confirmation redirect's query string

Thanks for the advice.

However, my app was recently rejected stating that I needed to upgrade to AppBridge v2 so I’m a little confused what to do since v2 isn’t working.

Yep, we are required to upgrade to v2 by end of 2021

Hello,

I am not sure if your stack is the same but I received a working workaround from a Shopify Staff.

https://community.shopify.com/c/Shopify-APIs-SDKs/Redirect-after-creating-recurring-application-charge-does-not/m-p/1174733/highlight/true#M66911

1 Like

How am I supposed to submit my app then if v2 isn’t working yet?

(they rejected it because I was using v1)…

You can find host here:

https://example.org/some/redirect/uri?code={authorization_code}&hmac=da9d83c171400a41f8db91a950508985&host={base64_encoded_hostname}&timestamp=1409617544&state={nonce}&shop={shop_origin}

use it to create your hmac to compare to Shopify’s (code, host, shop, state, timestamp)

1 Like

Thank you! I was able to find the host and set the config variable

Does anyone know how to add the host param when using the useAppBridge hook?

const app = useAppBridge();
const redirectToProduct = () => {
const redirect = Redirect.create(app);
redirect.dispatch(
Redirect.Action.APP,
‘/edit-products’,
);
};

Results in INVALID_CONFIG: host must be provided still even when host is provided in _app.js

Option #2

Only if you absolutely must. But if you’re going with nodejs and koa-shopify-auth, it’s all handled for you and proper encoded host will be made available upon completion of the client auth process.

const params = new URLSearchParams(window.location.search);
const query = {
      host: params.get("host"),
      shop: params.get("shop")
};

// base64 encode "shop/admin" if query.host is absent
let host = query.host || btoa(`${query.shop}/admin`);

const provider = ;