Skip to content

Commit 0e0a7de

Browse files
committed
chore: resolve comments
1 parent 437d9b8 commit 0e0a7de

File tree

2 files changed

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

2 files changed

+33
-33
lines changed

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

+17-17
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ In this example, if the incoming request is not associated with a valid user ses
228228
To authenticate users on the server side, you must enable either Amazon Cognito Managed Login or Hosted UI in your Amazon Cognito User Pool client.
229229

230230

231-
**Step 1: Specify the origin of your app in environment variables**
231+
**Step 1 - Specify the origin of your app in environment variables**
232232

233233
Add the following environment variables to your Next.js app. For example in a `.env` file:
234234

@@ -242,11 +242,11 @@ Ensure this environment variables is accessible in your Next.js app's server run
242242
243243
**Step 2 - Export the `createAuthRouteHandlers` function**
244244

245-
`createAuthRouteHandlers` function is created by the `createServerRunner` function call when you configure Amplify for server-side usage. You can export this function from your `amplifyServerUtils.ts` file. You can also configure cookie attributes with the `runtimeOptions` parameter.
245+
The `createAuthRouteHandlers` function is created by the `createServerRunner` function call when you configure Amplify for server-side usage. You can export this function from your `amplifyServerUtils.ts` file. You can also configure cookie attributes with the `runtimeOptions` parameter.
246246

247247
```typescript title="utils/amplifyServerUtils.ts"
248248
import { createServerRunner } from '@aws-amplify/adapter-nextjs';
249-
import config from '@/amplifyconfiguration.json';
249+
import config from '@/amplify_outputs.json';
250250

251251
export const {
252252
runWithAmplifyServerContext
@@ -272,7 +272,7 @@ export const {
272272
Create an API route using the `createAuthRouteHandlers` function. For example:
273273

274274
<BlockSwitcher>
275-
<Block name="With the App router">
275+
<Block name="App router">
276276
```typescript title="src/app/api/auth/[slug].ts"
277277
import { createAuthRouteHandlers } from "@/amplifyServerUtils";
278278

@@ -282,7 +282,7 @@ export const GET = createAuthRouteHandlers({
282282
});
283283
```
284284
</Block>
285-
<Block name="With Pages router">
285+
<Block name="Pages router">
286286
```typescript title="src/pages/api/auth/[slug].ts"
287287
import { createAuthRouteHandlers } from "@/amplifyServerUtils";
288288

@@ -298,12 +298,12 @@ With the above example, Amplify generates the following API routes:
298298

299299
| API Routes | What it does |
300300
| --------------------------------------------------- | ------------------------------------------------------------ |
301-
| `/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 specified by the `redirectOnSignInComplete` parameter. |
302-
| `/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 specified by the `redirectOnSignInComplete` parameter. |
303-
| `/api/auth/sign-in?provider=<social-provider-name>` | Upon navigating an end user to this route, they’ll be redirected to Amazon Cognito Managed Login. Then, they’ll be redirected to the specified social provider sign-in page. After sign-in, they’ll be redirected back to the route specified by the `redirectOnSignOutComplete` parameter. |
304-
| `/api/auth/sign-out` | Upon navigating an end user to this route, the end user will be signed out and redirected to the route specified by the redirectOnSignOutComplete parameter. |
305-
| `/api/auth/sign-in-callback` | Amazon Cognito Managed Login redirects users back to this route after signing in. Amplify exchanges auth tokens and stores them as HTTP-only cookies in the browser cookie store. |
306-
| `/api/auth/sign-out-callback` | Amazon Cognito Managed Login redirects an end user back to this router after signing out, Amplify revokes access token and refresh token and removes token cookies from browser cookie store. |
301+
| `/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`. |
302+
| `/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`. |
304+
| `/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`. |
305+
| `/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 HTTP-only cookies in the browser cookie store, then redirects the end user back to the route specified by the `redirectOnSignInComplete` parameter. |
306+
| `/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. |
307307

308308
> **Note:** A signing-out call involves multiple steps, including signing out from Amazon Cognito Managed Login, revoking tokens, and removing cookies. If the user closes the browser during the process, the following may occur:
309309
>
@@ -346,32 +346,32 @@ export const SignInButton() {
346346
</Block>
347347
<Block name="Sign in with Google button">
348348
```tsx title="src/components/SignInWithGoogleButton.tsx"
349-
export const SignInButton() {
349+
export const SignInWithGoogleButton() {
350350
return (
351351
<a href="/api/auth/sign-in?provider=Google">
352-
Sign In
352+
Sign In with Google
353353
</a>
354354
);
355355
}
356356
```
357357
</Block>
358358
<Block name="Sign up button">
359359
```tsx title="src/components/SignUpButton.tsx"
360-
export const SignInButton() {
360+
export const SignUpButton() {
361361
return (
362362
<a href="/api/auth/sign-up">
363-
Sign In
363+
Sign Up
364364
</a>
365365
);
366366
}
367367
```
368368
</Block>
369369
<Block name="Sign out button">
370370
```tsx title="src/components/SignOutButton.tsx"
371-
export const SignInButton() {
371+
export const SignOutButton() {
372372
return (
373373
<a href="/api/auth/sign-out">
374-
Sign In
374+
Sign Out
375375
</a>
376376
);
377377
}

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

+16-16
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ In this example, if the incoming request is not associated with a valid user ses
230230
To authenticate users on the server side, you must enable either Amazon Cognito Managed Login or Hosted UI in your Amazon Cognito User Pool client.
231231

232232

233-
**Step 1: Specify the origin of your app in environment variables**
233+
**Step 1 - Specify the origin of your app in environment variables**
234234

235235
Add the following environment variables to your Next.js app. For example in a `.env` file:
236236

@@ -244,7 +244,7 @@ Ensure this environment variables is accessible in your Next.js app's server run
244244
245245
**Step 2 - Export the `createAuthRouteHandlers` function**
246246

247-
`createAuthRouteHandlers` function is created by the `createServerRunner` function call when you configure Amplify for server-side usage. You can export this function from your `amplifyServerUtils.ts` file. You can also configure cookie attributes with the `runtimeOptions` parameter.
247+
The `createAuthRouteHandlers` function is created by the `createServerRunner` function call when you configure Amplify for server-side usage. You can export this function from your `amplifyServerUtils.ts` file. You can also configure cookie attributes with the `runtimeOptions` parameter.
248248

249249
```typescript title="utils/amplifyServerUtils.ts"
250250
import { createServerRunner } from '@aws-amplify/adapter-nextjs';
@@ -274,7 +274,7 @@ export const {
274274
Create an API route using the `createAuthRouteHandlers` function. For example:
275275

276276
<BlockSwitcher>
277-
<Block name="With the App router">
277+
<Block name="App router">
278278
```typescript title="src/app/api/auth/[slug].ts"
279279
import { createAuthRouteHandlers } from "@/amplifyServerUtils";
280280

@@ -284,7 +284,7 @@ export const GET = createAuthRouteHandlers({
284284
});
285285
```
286286
</Block>
287-
<Block name="With Pages router">
287+
<Block name="Pages router">
288288
```typescript title="src/pages/api/auth/[slug].ts"
289289
import { createAuthRouteHandlers } from "@/amplifyServerUtils";
290290

@@ -300,12 +300,12 @@ With the above example, Amplify generates the following API routes:
300300

301301
| API Routes | What it does |
302302
| --------------------------------------------------- | ------------------------------------------------------------ |
303-
| `/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 specified by the `redirectOnSignInComplete` parameter. |
304-
| `/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 specified by the `redirectOnSignInComplete` parameter. |
305-
| `/api/auth/sign-in?provider=<social-provider-name>` | Upon navigating an end user to this route, they’ll be redirected to Amazon Cognito Managed Login. Then, they’ll be redirected to the specified social provider sign-in page. After sign-in, they’ll be redirected back to the route specified by the `redirectOnSignOutComplete` parameter. |
306-
| `/api/auth/sign-out` | Upon navigating an end user to this route, the end user will be signed out and redirected to the route specified by the redirectOnSignOutComplete parameter. |
307-
| `/api/auth/sign-in-callback` | Amazon Cognito Managed Login redirects users back to this route after signing in. Amplify exchanges auth tokens and stores them as HTTP-only cookies in the browser cookie store. |
308-
| `/api/auth/sign-out-callback` | Amazon Cognito Managed Login redirects an end user back to this router after signing out, Amplify revokes access token and refresh token and removes token cookies from browser cookie store. |
303+
| `/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`. |
304+
| `/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`. |
306+
| `/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`. |
307+
| `/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 HTTP-only cookies in the browser cookie store, then redirects the end user back to the route specified by the `redirectOnSignInComplete` parameter. |
308+
| `/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. |
309309

310310
> **Note:** A signing-out call involves multiple steps, including signing out from Amazon Cognito Managed Login, revoking tokens, and removing cookies. If the user closes the browser during the process, the following may occur:
311311
>
@@ -342,32 +342,32 @@ export const SignInButton() {
342342
</Block>
343343
<Block name="Sign in with Google button">
344344
```tsx title="src/components/SignInWithGoogleButton.tsx"
345-
export const SignInButton() {
345+
export const SignInWithGoogleButton() {
346346
return (
347347
<a href="/api/auth/sign-in?provider=Google">
348-
Sign In
348+
Sign In with Google
349349
</a>
350350
);
351351
}
352352
```
353353
</Block>
354354
<Block name="Sign up button">
355355
```tsx title="src/components/SignUpButton.tsx"
356-
export const SignInButton() {
356+
export const SignUpButton() {
357357
return (
358358
<a href="/api/auth/sign-up">
359-
Sign In
359+
Sign Up
360360
</a>
361361
);
362362
}
363363
```
364364
</Block>
365365
<Block name="Sign out button">
366366
```tsx title="src/components/SignOutButton.tsx"
367-
export const SignInButton() {
367+
export const SignOutButton() {
368368
return (
369369
<a href="/api/auth/sign-out">
370-
Sign In
370+
Sign Out
371371
</a>
372372
);
373373
}

0 commit comments

Comments
 (0)