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