You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pages/[platform]/start/quickstart/nextjs-app-router-client-components/index.mdx
+63-34Lines changed: 63 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -219,43 +219,73 @@ This should start a local dev server at http://localhost:3000.
219
219
220
220
The starter application already has a pre-configured auth backend defined in the **amplify/auth/resource.ts** file. We've configured it to support email and password login but you can extend it to support a variety of login mechanisms, including Google, Amazon, Sign In With Apple, and Facebook.
221
221
222
-
The fastest way to get your login experience up and running is to use our Authenticator UI component. First, install the Amplify UI component library:
222
+
The fastest way to get your login experience up and running is to use our Authenticator UI component. In your **app/layout.tsx** file, import the Authenticator UI component and wrap the children or pages components.
223
223
224
-
```bash showLineNumbers={false}
225
-
npm add @aws-amplify/ui-react
226
-
```
227
-
228
-
Next, import the Authenticator UI component and wrap your `<main>` element.
The Authenticator component auto-detects your auth backend settings and renders the correct UI state based on the auth backend's authentication flow.
258
259
260
+
In your **app/page.tsx** file, add a button to enable users to sign out of the application. Import the [`useAuthenticator`](https://ui.docs.amplify.aws/react/connected-components/authenticator/advanced#access-auth-state) hook from the Amplify UI library to hook into the state of the Authenticator.
@@ -329,24 +359,23 @@ export const data = defineData({
329
359
});
330
360
```
331
361
332
-
In the application client code, let's also render the username to distinguish different users once they're logged in. Go to your **app/page.tsx** file and render the `user` property.
362
+
In the application client code, let's also render the username to distinguish different users once they're logged in. Go to your **app/page.tsx** file and render the `user` property from the `useAuthenticator` hook.
0 commit comments