Skip to content

Commit fd96feb

Browse files
committed
fix: problem with custom app install not passing the cookies due to sameSite=lax.
See this PR for other people who have ran into this issue Shopify#905
1 parent 51f3c27 commit fd96feb

File tree

1 file changed

+5
-2
lines changed
  • packages/shopify-api/lib/auth/oauth

1 file changed

+5
-2
lines changed

packages/shopify-api/lib/auth/oauth/oauth.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,12 @@ export function begin(config: ConfigInterface): OAuthBegin {
9494

9595
await cookies.setAndSign(STATE_COOKIE_NAME, state, {
9696
expires: new Date(Date.now() + 60000),
97-
sameSite: 'lax',
98-
secure: true,
97+
// hack necessary due to browsers not setting cookies with sameSite=lax
98+
// https://github.com/Shopify/shopify-api-js/pull/905
99+
sameSite: 'none',
100+
secure: true, // needs to be true, especially when sameSite=none
99101
path: callbackPath,
102+
domain: config.cookieDomain || undefined,
100103
});
101104

102105
const query = {

0 commit comments

Comments
 (0)