User Authentication with React Native & AWS using React Native Navigation (V2)
Adding Authentication to a React Native app with React Native Navigation & AWS.
This is part 2 of a 2 part series. For part 1, click here.
Continuing on from Part1, we now want to add real user signup & signin to our app using AWS.
We’ll use AWS Amplify to connect to AWS, & Amazon Cognito to manage users.
If you already have the code from part 1, you can skip to the next step. If you are starting from here, you can clone the project from this repo and start from there.
Creating the Auth service
From within the root of the React Native project, we would like to initialize a new AWS project so that we can add authentication. To do so, we need to install & configure the AWS Mobile CLI:
npm i -g awsmobile-cli
awsmobile configure
Once you’ve installed & configured the CLI, initialize a new AWS project:
awsmobile init
This command will do a few things:
- Create a new Mobile Hub project in our AWS Account.
- Install a couple of dependencies into our project:
aws-amplify
&aws-amplify-react-native
. - Add local configuration files (
awsmobilejs
&aws-exports.js
) that will allow us to edit configuration locally via the cli & push changes to our AWS Mobile Hub project in the AWS…