Created
January 10, 2020 11:32
-
-
Save praveen001/d34e09af71807a64640509b32c2df8d4 to your computer and use it in GitHub Desktop.
Authentication in Serverless React Application using AWS Amplify
This file contains 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 { withAuthenticator } from 'aws-amplify-react'; | |
function App() { | |
return ( | |
... | |
) | |
} | |
export default withAuthenticator(App, { | |
includeGreetings: true | |
}); |
This file contains 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
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 | |
}); |
This file contains 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
export default withAuthenticator(App, { | |
includeGreetings, | |
signUpConfig, | |
federated: { | |
google_client_id: 'google-client-id-goes-here', | |
facebook_app_id: 'facebook-app-id-goes-here' | |
} | |
}); |
This file contains 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 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