forked from aws-amplify/amplify-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add cognito js lib and update references * update cognito lib * update node version and package deps * update cognito sdk and auth test * update travis commands * update react tests * update travis * update with yarn workspaces and modules * update with yarn workspaces and modules * add lint to test * update test cmd * update test cmd * update test cmd * update build cmds * update concurrency with bootstrap * set yarn workspaces * update travis * update deps, yarn should use local * remove workspaces * update workspaces * add build before test for workspaces * update travis * remove package-lock.json * update rn package * update deps on react native * update user attributes * update user attributes * fix variable * update docs * for rn * core change * Update package.json * Adds a podspec for CocoaPods support
- Loading branch information
1 parent
911abdf
commit fc8722e
Showing
170 changed files
with
77,482 additions
and
55,358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
language: node_js | ||
sudo: false | ||
node_js: | ||
- 6 | ||
- 8 | ||
install: | ||
- npm install | ||
- yarn config set workspaces-experimental true | ||
- yarn | ||
script: | ||
- npm run bootstrap | ||
- npm run lint | ||
- npm run test | ||
- npm run coverage | ||
- npm run build | ||
- npm run docs | ||
- yarn bootstrap | ||
- yarn build | ||
- yarn test --scope aws-amplify | ||
- yarn test --scope aws-amplify-react | ||
- yarn coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
{ | ||
"lerna": "2.4.0", | ||
"npmClient": "yarn", | ||
"useWorkspaces": true, | ||
"packages": [ | ||
"packages/*" | ||
], | ||
"version": "0.0.0" | ||
"version": "independent" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ The AWS Amplify Auth module provides Authentication APIs and building blocks to | |
- [4. Compose Authenticator](#4-compose-authenticator) | ||
- [5. Write Your Own Auth UI](#5-write-your-own-auth-ui) | ||
- [6. Federated Identity](#6-federated-identity) | ||
- [7. User Attributes](#6-user-attributes) | ||
* [Extension](#extension) | ||
- [UI Theme](#ui-theme) | ||
- [Error Message](#error-message) | ||
|
@@ -74,10 +75,13 @@ import { Auth } from 'aws-amplify'; | |
Auth.signUp({ | ||
username, | ||
password, | ||
email, // optional | ||
phone, // optional | ||
// other custom attributes if has been set in Cognito | ||
// myAttr: ... | ||
attributes: { | ||
email, // optional | ||
phone, // optional | ||
// other custom attributes if has been set in Cognito | ||
// myAttr: ... | ||
}, | ||
validationData: [] //optional | ||
}) | ||
.then(data => console.log(data)) | ||
.catch(err => console.log(err)); | ||
|
@@ -143,6 +147,44 @@ const federated = { | |
ReactDOM.render(<AppWithAuth federated={federated}/>, document.getElementById('root')); | ||
``` | ||
|
||
#### User Attributes | ||
|
||
You can pass in any user attributes during sign in: | ||
|
||
```js | ||
Auth.signUp({ | ||
'username': 'jdoe', | ||
'password': 'mysecurerandompassword#123', | ||
'email': '[email protected]', | ||
'phone_number': '+12128601234', | ||
'first_name': 'Jane', | ||
'last_name': 'Doe', | ||
'nick_name': 'Jane' | ||
}); | ||
``` | ||
|
||
You can retrieve user attributes: | ||
|
||
```js | ||
let profile = await Auth.currentUserInfo(); | ||
``` | ||
|
||
You can then update the user attributes: | ||
|
||
```js | ||
let result = await Auth.updateUserAttributes({ | ||
'email': '[email protected]', | ||
'last_name': 'Lastname' | ||
}); | ||
console.log(result); // SUCCESS | ||
``` | ||
|
||
If you change the email address you will receive a confirmation code to that email and you can confirm it with the code: | ||
|
||
```js | ||
let result = await Auth.verifyCurrentUserAttributeSubmit('email',abc123); | ||
``` | ||
|
||
#### Sign Out Button | ||
|
||
The default `withAuthenticator` renders just the App component after a user is signed in, preventing interference with your app. Then question comes, how does the user sign out? | ||
|
Oops, something went wrong.