Skip to content

Commit

Permalink
Link cognito sdk (#182)
Browse files Browse the repository at this point in the history
* 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
mlabieniec committed Jan 25, 2018
1 parent 911abdf commit fc8722e
Show file tree
Hide file tree
Showing 170 changed files with 77,482 additions and 55,358 deletions.
16 changes: 8 additions & 8 deletions .travis.yml
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
4 changes: 3 additions & 1 deletion lerna.json
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"
}
50 changes: 46 additions & 4 deletions media/authentication_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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': 'me@domain.com',
'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': 'me@anotherdomain.com',
'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?
Expand Down
Loading

0 comments on commit fc8722e

Please sign in to comment.