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-pages-router/index.mdx
+51-34Lines changed: 51 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -221,39 +221,28 @@ This should start a local dev server at http://localhost:3000.
221
221
222
222
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.
223
223
224
-
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:
224
+
The fastest way to get your login experience up and running is to use our Authenticator UI component. In your **pages/_app.tsx** file, import the Authenticator UI component and wrap your `<App>` component.
225
225
226
-
```bash showLineNumbers={false}
227
-
npm add @aws-amplify/ui-react
228
-
```
229
-
230
-
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.
307
296
297
+
In your **pages/index.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.
@@ -378,24 +396,23 @@ export const data = defineData({
378
396
});
379
397
```
380
398
381
-
In the application client code, let's also render the username to distinguish different users once they're logged in. Go to your **src/App.tsx** file and render the `user` property.
399
+
In the application client code, let's also render the username to distinguish different users once they're logged in. Go to your **pages/index.tsx** file and render the `user` property from the `useAuthenticator` hook.
0 commit comments