Skip to content

Commit 6c39640

Browse files
committed
chore: resolve comments
1 parent ccca1a4 commit 6c39640

File tree

2 files changed

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

2 files changed

+16
-8
lines changed

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

+8-4
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ In this example, if the incoming request is not associated with a valid user ses
219219

220220
<Callout warning>
221221

222-
**NOTE:** Once you enable the server-side sign-in feature, auth tokens are stored in HttpOnly cookies and you may not change the HttpOnly attribute. Since these cookies are inaccessible from client-side scripts, you won’t be able to use any Amplify JS APIs on the client side. Therefore, you don’t need to configure Amplify on the client side. You can keep using [these Amplify JS server-side APIs](/[platform]/build-a-backend/server-side-rendering/#supported-apis-for-nextjs-server-side-usage) on the server side.
222+
**Warning:** Once you enable the server-side sign-in feature, auth tokens are stored in HttpOnly cookies and you may not change the HttpOnly attribute. Since these cookies are inaccessible from client-side scripts, you won’t be able to use any Amplify JS APIs on the client side. Therefore, you don’t need to configure Amplify on the client side. You can keep using [these Amplify JS server-side APIs](/[platform]/build-a-backend/server-side-rendering/#supported-apis-for-nextjs-server-side-usage) on the server side.
223223

224224
</Callout>
225225

@@ -238,7 +238,11 @@ AMPLIFY_APP_ORIGIN=https://myapp.com
238238

239239
Ensure this environment variables is accessible in your Next.js app's server runtime.
240240

241-
> **Note:** Token cookies are transmitted via server-side authentication flows. In production environments, it is recommended to use HTTPS as the origin for enhanced security.
241+
<Callout info>
242+
243+
**Note:** Token cookies are transmitted via server-side authentication flows. In production environments, it is recommended to use HTTPS as the origin for enhanced security.
244+
245+
</Callout>
242246

243247
#### Step 2 - Export the `createAuthRouteHandlers` function
244248

@@ -273,7 +277,7 @@ Create an API route using the `createAuthRouteHandlers` function. For example:
273277

274278
<BlockSwitcher>
275279
<Block name="App router">
276-
```typescript title="src/app/api/auth/[slug].ts"
280+
```typescript title="src/app/api/auth/[slug]/route.ts"
277281
import { createAuthRouteHandlers } from "@/utils/amplifyServerUtils";
278282

279283
export const GET = createAuthRouteHandlers({
@@ -300,7 +304,7 @@ With the above example, Amplify generates the following API routes:
300304
| --------------------------------------------------- | ------------------------------------------------------------ |
301305
| `/api/auth/sign-up` | Upon navigating an end user to this route, they’ll be redirected to the Amazon Cognito Managed Login sign-up form. After sign-up and sign-in, they’ll be redirected back to the route `/api/auth/sign-in-callback`. |
302306
| `/api/auth/sign-in` | Upon navigating an end user to this route, they’ll be redirected to the Amazon Cognito Managed Login sign-in form. After sign-in, they’ll be redirected back to the route `/api/auth/sign-in-callback`. |
303-
| `/api/auth/sign-in?provider=<social-provider-name>` | Upon navigating an end user to this route, they’ll be redirected to first to the Amazon Cognito Managed Login and then the specified social provider sign-in page. After sign-in, they’ll be redirected back to the route `/api/auth/sign-in-callback`. |
307+
| `/api/auth/sign-in?provider=<social-provider-name>` | Upon navigating an end user to this route, they’ll be redirected first to the Amazon Cognito Managed Login and then the specified social provider sign-in page. After sign-in, they’ll be redirected back to the route `/api/auth/sign-in-callback`. |
304308
| `/api/auth/sign-out` | Upon navigating an end user to this route, the end user will be signed out and redirected to the route `/api/auth/sign-out-callback`. |
305309
| `/api/auth/sign-in-callback` | Amazon Cognito Managed Login redirects an end user back to this route after signing in. Amplify exchanges auth tokens and stores them as HttpOnly cookies in the browser cookie store, then redirects the end user back to the route specified by the `redirectOnSignInComplete` parameter. |
306310
| `/api/auth/sign-out-callback` | Amazon Cognito Managed Login redirects an end user back to this route after signing out, Amplify revokes access token and refresh token and removes token cookies from browser cookie store, then redirects the end user back to the route specified by the `redirectOnSignOutComplete` parameter. |

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

+8-4
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ In this example, if the incoming request is not associated with a valid user ses
221221

222222
<Callout warning>
223223

224-
**NOTE:** Once you enable the server-side sign-in feature, auth tokens are stored in HttpOnly cookies and you may not change the HttpOnly attribute. Since these cookies are inaccessible from client-side scripts, you won’t be able to use any Amplify JS APIs on the client side. Therefore, you don’t need to configure Amplify on the client side. You can keep using [these Amplify JS server-side APIs](/gen1/[platform]/build-a-backend/server-side-rendering/nextjs/#supported-apis-for-nextjs-server-side-usage) on the server side.
224+
**Warning:** Once you enable the server-side sign-in feature, auth tokens are stored in HttpOnly cookies and you may not change the HttpOnly attribute. Since these cookies are inaccessible from client-side scripts, you won’t be able to use any Amplify JS APIs on the client side. Therefore, you don’t need to configure Amplify on the client side. You can keep using [these Amplify JS server-side APIs](/gen1/[platform]/build-a-backend/server-side-rendering/nextjs/#supported-apis-for-nextjs-server-side-usage) on the server side.
225225

226226
</Callout>
227227

@@ -240,7 +240,11 @@ AMPLIFY_APP_ORIGIN=https://myapp.com
240240

241241
Ensure this environment variables is accessible in your Next.js app's server runtime.
242242

243-
> **Note:** Token cookies are transmitted via server-side authentication flows. In production environments, it is recommended to use HTTPS as the origin for enhanced security.
243+
<Callout info>
244+
245+
**Note:** Token cookies are transmitted via server-side authentication flows. In production environments, it is recommended to use HTTPS as the origin for enhanced security.
246+
247+
</Callout>
244248

245249
#### Step 2 - Export the `createAuthRouteHandlers` function
246250

@@ -275,7 +279,7 @@ Create an API route using the `createAuthRouteHandlers` function. For example:
275279

276280
<BlockSwitcher>
277281
<Block name="App router">
278-
```typescript title="src/app/api/auth/[slug].ts"
282+
```typescript title="src/app/api/auth/[slug]/route.ts"
279283
import { createAuthRouteHandlers } from "@/utils/amplifyServerUtils";
280284

281285
export const GET = createAuthRouteHandlers({
@@ -302,7 +306,7 @@ With the above example, Amplify generates the following API routes:
302306
| --------------------------------------------------- | ------------------------------------------------------------ |
303307
| `/api/auth/sign-up` | Upon navigating an end user to this route, they’ll be redirected to the Amazon Cognito Managed Login sign-up form. After sign-up and sign-in, they’ll be redirected back to the route `/api/auth/sign-in-callback`. |
304308
| `/api/auth/sign-in` | Upon navigating an end user to this route, they’ll be redirected to the Amazon Cognito Managed Login sign-in form. After sign-in, they’ll be redirected back to the route `/api/auth/sign-in-callback`. |
305-
| `/api/auth/sign-in?provider=<social-provider-name>` | Upon navigating an end user to this route, they’ll be redirected to first to the Amazon Cognito Managed Login and then the specified social provider sign-in page. After sign-in, they’ll be redirected back to the route `/api/auth/sign-in-callback`. |
309+
| `/api/auth/sign-in?provider=<social-provider-name>` | Upon navigating an end user to this route, they’ll be redirected first to the Amazon Cognito Managed Login and then the specified social provider sign-in page. After sign-in, they’ll be redirected back to the route `/api/auth/sign-in-callback`. |
306310
| `/api/auth/sign-out` | Upon navigating an end user to this route, the end user will be signed out and redirected to the route `/api/auth/sign-out-callback`. |
307311
| `/api/auth/sign-in-callback` | Amazon Cognito Managed Login redirects an end user back to this route after signing in. Amplify exchanges auth tokens and stores them as HttpOnly cookies in the browser cookie store, then redirects the end user back to the route specified by the `redirectOnSignInComplete` parameter. |
308312
| `/api/auth/sign-out-callback` | Amazon Cognito Managed Login redirects an end user back to this route after signing out, Amplify revokes access token and refresh token and removes token cookies from browser cookie store, then redirects the end user back to the route specified by the `redirectOnSignOutComplete` parameter. |

0 commit comments

Comments
 (0)