Skip to content

Instantly share code, notes, and snippets.

@praveen001
Created January 10, 2020 11:32
Show Gist options
  • Save praveen001/d34e09af71807a64640509b32c2df8d4 to your computer and use it in GitHub Desktop.
Save praveen001/d34e09af71807a64640509b32c2df8d4 to your computer and use it in GitHub Desktop.
Authentication in Serverless React Application using AWS Amplify
import { withAuthenticator } from 'aws-amplify-react';
function App() {
return (
...
)
}
export default withAuthenticator(App, {
includeGreetings: true
});
const signUpConfig = {
header: 'Create an Account',
hideAllDefaults: true,
defaultCountryCode: '1',
signUpFields: [
{
label: 'Name',
key: 'name',
required: true,
displayOrder: 1,
type: 'string'
},
{
label: 'Email or Phone number',
key: 'username',
required: true,
displayOrder: 2,
type: 'string'
},
{
label: 'Password',
key: 'password',
required: true,
displayOrder: 3,
type: 'password'
}
]
};
export default withAuthenticator(App, {
includeGreetings,
signUpConfig
});
export default withAuthenticator(App, {
includeGreetings,
signUpConfig,
federated: {
google_client_id: 'google-client-id-goes-here',
facebook_app_id: 'facebook-app-id-goes-here'
}
});
import Amplify from 'aws-amplify';
import config from './aws-exports.js';
Amplify.configure(config);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment