Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Latest commit

 

History

History
42 lines (25 loc) · 1020 Bytes

getEmbeddedAppUrl.md

File metadata and controls

42 lines (25 loc) · 1020 Bytes

shopify.auth.getEmbeddedAppUrl

If you need to redirect a request to your embedded app URL you can use getEmbeddedAppUrl.

Using this method ensures that the embedded app URL is properly constructed and brings the merchant to the right place. It is more reliable than using the shop param.

This method relies on the host query param being a Base 64 encoded string. All requests from Shopify should include this param in the correct format.

Example

app.get('/redirect/endpoint', async (req, res) => {
  const redirectURL = await shopify.auth.getEmbeddedAppUrl({
    rawRequest: req,
    rawResponse: res,
  });

  res.redirect(redirectURL);
});

Parameters

rawRequest

AdapterRequest| ❗ required

The HTTP Request object used by your runtime.

rawResponse

AdapterResponse| ❗ required for Node.js

The HTTP Response object used by your runtime.

Return

Promise<string>

The appropriate Shopify address to redirect to.

Back to shopify.auth