Due to aws-amplify is not support user pool & hosted UI with react-native in current time, so I made this PoC to login with amplify & identity pool (federated login) via Google & Facebook social login.
Anyway, I am looking forward to the way that we can login with cognito user-pool & react-native supported hosted-ui (Native-based).
-
Please refer the AWS Amplify official documentation to set your AWS Mobile Hub & Cognito.
-
Set your Facebook App & Google App (OAuth 2.0 Client ID).
-
Replaced
android/app/google-services.json
with you Firebase app. (If you want to login with google) -
Make sure that you have set the
aws-exports.js
insrc/
, like:const awsmobile = { 'aws_auth_facebook': 'enable', 'aws_cognito_identity_pool_id': 'us-west-2:xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx', 'aws_cognito_region': 'us-west-x', 'aws_facebook_app_id': 'xxxxxxxxxxxxxxxxx', 'aws_facebook_app_permissions': 'public_profile', 'aws_google_app_permissions': 'email,profile,openid', 'aws_google_web_app_id': 'xxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com', 'aws_project_id': 'xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxx', 'aws_project_name': 'react-native-amplify-cognito-example-xxxxxxxxxx', 'aws_project_region': 'us-west-x', 'aws_resource_name_prefix': 'reactnativeamplifyco-mobilehub-xxxxxxxx', 'aws_sign_in_enabled': 'enable', } export default awsmobile;
-
Run
react-native run-android
orreact-native run-ios
- react-native 0.55.4
- react-native-fbsdk 0.7.0
- react-native-google-signin 0.12.0 (with patches)
- aws-amplify 0.3.3
- patch-package 5.1.1 (for patching react-native-google-signin)
- Cocoapods 1.4.0
MIT License