Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save maskaravivek/7ef258de9b0e2ce380af9f81945196c5 to your computer and use it in GitHub Desktop.
Save maskaravivek/7ef258de9b0e2ce380af9f81945196c5 to your computer and use it in GitHub Desktop.
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