Menu
AWS Mobile
Developer Guide

Add Auth / User Sign-in

BEFORE YOU BEGIN

The steps on this page assume you have already completed the steps on Get Started.

Set Up Your Backend

The AWS Mobile CLI components for user authentication include a rich, configurable UI for sign-up and sign-in.

To enable the Auth features

In the root folder of your app, run:

awsmobile user-signin enable awsmobile push

Connect to Your Backend

The AWS Mobile CLI enables you to integrate ready-made sign-up/sign-in/sign-out UI from the command line.

To add user auth UI to your app

  1. Install AWS Amplify for React Nativelibrary.

    npm install --save aws-amplify npm install --save aws-amplify-react-native

Note

If your react-native app was not created using create-react-native-app or using a version of Expo lower than v25.0.0 (the engine behind create-react-native-app), you will need to link libraries in your project for the Auth module on React Native, amazon-cognito-identity-js.

To link to the module, you must first eject the project:

npm run eject react-native link amazon-cognito-identity-js
  1. Add the following import in App.js (or other file that runs upon app startup):

    import { withAuthenticator } from 'aws-amplify-react-native';
  2. Then change export default App; to the following.

    export default withAuthenticator(App);

To test, run npm start or awsmobile run.

Next Steps

Learn more about the AWS Mobile User Sign-in feature, which uses Amazon Cognito.

Learn about AWS Mobile CLI.

Learn about AWS Mobile Amplify.