Created
May 28, 2023 20:54
-
-
Save maskaravivek/7ef258de9b0e2ce380af9f81945196c5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Amplify } from 'aws-amplify'; | |
| import { Authenticator } from '@aws-amplify/ui-react'; | |
| import '@aws-amplify/ui-react/styles.css'; | |
| Authorization.configure({ | |
| Auth: { | |
| region: "<USER_POOL_REGION>", | |
| userPoolId: "<USER_POOL_ID>", | |
| userPoolWebClientId: "<USER_POOL_WEB_CLIENT_ID>", | |
| authenticationFlowType: 'USER_PASSWORD_AUTH', | |
| oauth: { | |
| domain: '<your_custom_domain_prefix>.us-west-2.amazoncognito.com', | |
| scope: [ | |
| 'phone', | |
| 'email', | |
| 'profile', | |
| 'openid', | |
| 'aws.cognito.signin.user.admin', | |
| ], | |
| redirectSignIn: '<your_callback_url>', | |
| responseType: 'code' | |
| }, | |
| }, | |
| }); | |
| export default function App() { | |
| return ( | |
| <Authenticator socialProviders={['google']}> | |
| {({ signOut, user }) => ( | |
| <main> | |
| <h1>Hello {user.username}</h1> | |
| <button onClick={signOut}>Sign out</button> | |
| </main> | |
| )} | |
| </Authenticator> | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment