Skip to content

Commit

Permalink
feat(next-drupal)!: drop forceIframeSameSiteCookie option
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
The forceIframeSameSiteCookie option to DrupalClient has been removed. The
DrupalClient now automatically makes this change when the Next.js website is
running in development mode (and the change is not needed for production sites).
  • Loading branch information
JohnAlbin committed Jan 30, 2024
1 parent a4f8d84 commit 083cebb
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 43 deletions.
1 change: 0 additions & 1 deletion examples/example-graphql/lib/drupal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const drupal = new DrupalClient(
clientSecret: process.env.DRUPAL_CLIENT_SECRET,
},
previewSecret: process.env.DRUPAL_PREVIEW_SECRET,
forceIframeSameSiteCookie: true,
}
)

Expand Down
4 changes: 0 additions & 4 deletions packages/next-drupal/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ export class DrupalClient {

private previewSecret?: DrupalClientOptions["previewSecret"]

private forceIframeSameSiteCookie?: DrupalClientOptions["forceIframeSameSiteCookie"]

/**
* Instantiates a new DrupalClient.
*
Expand Down Expand Up @@ -142,7 +140,6 @@ export class DrupalClient {
auth,
previewSecret,
accessToken,
forceIframeSameSiteCookie = false,
throwJsonApiErrors = true,
} = options

Expand All @@ -160,7 +157,6 @@ export class DrupalClient {
this.previewSecret = previewSecret
this.cache = cache
this.accessToken = accessToken
this.forceIframeSameSiteCookie = forceIframeSameSiteCookie
this.throwJsonApiErrors = throwJsonApiErrors

// Do not throw errors in production.
Expand Down
10 changes: 0 additions & 10 deletions packages/next-drupal/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,6 @@ export type DrupalClientOptions = {
* The scope used for the current access token.
*/
accessTokenScope?: string

/**
* If set to true, the preview cookie will be set with SameSite=None,Secure.
*
* * **Default value**: `false`
* * **Required**: *No*
*
* [Documentation](https://next-drupal.org/docs/client/configuration#forceiframesamesitecookie)
*/
forceIframeSameSiteCookie?: boolean
}

export type DrupalClientAuth =
Expand Down
28 changes: 0 additions & 28 deletions www/content/docs/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -217,34 +217,6 @@ A long-lived access token you can set directly on the client.

---

### forceIframeSameSiteCookie

<Callout icon="⚠️">

Use `forceIframeSameSiteCookie` in development only.

</Callout>

- **Default value**: `false`
- **Required**: No

If you're running your site in development and the host address is different from the iframe preview, you might run into issues with `SameSite` cookies.

You can use this option to force the cookie to be set to `SameSite=None,Secure` in **development**.

```ts
export const drupal = new DrupalClient(
process.env.NEXT_PUBLIC_DRUPAL_BASE_URL,
{
forceIframeSameSiteCookie: process.env.NODE_ENV === "development",
}
)
```

For more info see: https://github.com/vercel/next.js/discussions/32238

---

### debug

- **Default value**: `false`
Expand Down

0 comments on commit 083cebb

Please sign in to comment.