react-native-amplify-cognito-example icon indicating copy to clipboard operation
react-native-amplify-cognito-example copied to clipboard

React Native Example: Login by AWS Amplify with AWS Cognito Identity Pools (Federated Identities)

React-Native Amplify Cognito Login Example App

Feature

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).

Instruction

  1. Please refer the AWS Amplify official documentation to set your AWS Mobile Hub & Cognito.

  2. Set your Facebook App & Google App (OAuth 2.0 Client ID).

  3. Replaced android/app/google-services.json with you Firebase app. (If you want to login with google)

  4. Make sure that you have set the aws-exports.js in src/, 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;
    
  5. Run react-native run-android or react-native run-ios

Packages

License

MIT License