AWS Mobile Hub Developer Guide
Developer Guide

Add Auth / User Sign-in


The following content applies if you are already using the AWS Mobile CLI to configure your backend. If you are building a new mobile or web app, or you're adding cloud capabilities to your existing app, use the new AWS Amplify CLI instead. With the new Amplify CLI, you can use all of the features described in Announcing the AWS Amplify CLI toolchain, including AWS CloudFormation functionality that provides additional workflows.

Set Up Your Backend


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

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

    npm install --save aws-amplify-react
  2. Add the following import in App.js (or other file that runs upon app startup):

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

    export default withAuthenticator(App);

To test, run npm start, awsmobile run, or awsmobile publish --test.

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.