Skip to content

Commit f7b8e5c

Browse files
committed
chore: add server-side cookie attributes setting limitation callout
1 parent e6af6e0 commit f7b8e5c

File tree

2 files changed

+10
-2
lines changed
  • src/pages
    • [platform]/build-a-backend/server-side-rendering
    • gen1/[platform]/build-a-backend/server-side-rendering/nextjs

2 files changed

+10
-2
lines changed

src/pages/[platform]/build-a-backend/server-side-rendering/index.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,11 @@ In this example, if the incoming request is not associated with a valid user ses
211211

212212
<Callout>
213213

214-
**NOTE:** When calling `fetchAuthSession` with a `response` context, it will send the refreshed tokens (if any) back to the client via the `Set-Cookie` header in the response.
214+
When calling `fetchAuthSession` with a `response` context, it will send the refreshed tokens (if any) back to the client via the `Set-Cookie` header in the response.
215+
216+
**Note:** The Next.js adapter currently doesn't support customization of cookie attributes from the server side, and cookies are always set with [default attribute values](https://github.com/aws-amplify/amplify-js/blob/2447917fb47ff616aca6f5d64f9c635cf738c7e3/packages/aws-amplify/src/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.ts#L10-L15).
217+
218+
If you are changing the cookie store on the client side, you may need to manually set the cookie attributes to match the server-side configuration. If you need to customize the cookie attributes, you can use the lower level [`runWithAmplifyServerContext` function](/gen1/[platform]/build-a-backend/server-side-rendering/) instead.
215219

216220
</Callout>
217221

src/pages/gen1/[platform]/build-a-backend/server-side-rendering/nextjs/index.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,11 @@ In this example, if the incoming request is not associated with a valid user ses
213213

214214
<Callout>
215215

216-
**NOTE:** When calling `fetchAuthSession` with a `response` context, it will send the refreshed tokens (if any) back to the client via the `Set-Cookie` header in the response.
216+
When calling `fetchAuthSession` with a `response` context, it will send the refreshed tokens (if any) back to the client via the `Set-Cookie` header in the response.
217+
218+
**Note:** The Next.js adapter currently doesn't support customization of cookie attributes from the server side, and cookies are always set with [default attribute values](https://github.com/aws-amplify/amplify-js/blob/2447917fb47ff616aca6f5d64f9c635cf738c7e3/packages/aws-amplify/src/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.ts#L10-L15).
219+
220+
If you are changing the cookie store on the client side, you may need to manually set the cookie attributes to match the server-side configuration. If you need to customize the cookie attributes, you can use the lower level [`runWithAmplifyServerContext` function](/gen1/[platform]/build-a-backend/server-side-rendering/) instead.
217221

218222
</Callout>
219223

0 commit comments

Comments
 (0)