From 342c124ed55d88a7941db444dbfa4cc689d50dc6 Mon Sep 17 00:00:00 2001 From: Ryan Martin Date: Tue, 13 Feb 2018 23:37:07 -0500 Subject: [PATCH] Document the configurable parameter of withAuthenticator --- README.md | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 30ce9914245..975fb67c138 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,9 @@ AWS Amplify is a JavaScript library for frontend and mobile developers building * [Examples](#example) - [1. Collect user session metrics.](#1-collect-user-session-metrics) - [2. Add Authentication](#2-add-authentication-to-your-app) - - [3. Sign HTTP requests](#3-sign-http-requests) - - [4. Upload and Download public or private content](#4-upload-and-download-public-or-private-content) + - [3. Override default authentication screens](#3-override-default-authentication-screens) + - [4. Sign HTTP requests](#4-sign-http-requests) + - [5. Upload and Download public or private content](#5-upload-and-download-public-or-private-content) * [Contributing](#contributing) ## Installation @@ -139,7 +140,40 @@ class App extends Component { export default withAuthenticator(App); ``` -### 3. Sign HTTP requests +### 3. Override default authentication screens + +The `withAuthenticator` HOC gives you some good default authentication screens. But if you need to +customize those screens with more than simply styles, it also provides an optional third parameter +through which you can pass the list of customized (or not) screens: + +```js +import React, { Component } from 'react'; +import { ConfirmSignIn, ConfirmSignUp, ForgotPassword, SignIn, SignUp, VerifyContact, withAuthenticator } from 'aws-amplify-react'; + +class App extends Component { + render() { + ... + } +} + +class MySignIn extends SignIn { + render() { + ... + } +} + +export default withAuthenticator(App, false, [ + , + , + , + , + , + +]); + +``` + +### 4. Sign HTTP requests Sign REST requests with [AWS Signature Version 4](http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html) using the API module to one or multiple endpoints: @@ -154,7 +188,7 @@ API.get(apiName, path, options).then(response => { }); ``` -### 4. Upload and Download public or private content +### 5. Upload and Download public or private content With configurable settings, store content in an S3 bucket in public folders for all of your application's users or in private folders for each user identity: