Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mlabieniec committed Apr 24, 2018
2 parents 5546e4a + 257a41a commit c0b7b9e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 8 additions & 0 deletions docs/media/federated_identity_setup.md
Expand Up @@ -3,6 +3,14 @@

# Federated Identity Setup

## Enabling federated sign-in

Amplify's Authentication category uses AWS Cognito User Pools, which requires identity providers to be registered.

If you are using Mobile Hub, you can register an identity provider by accessing the *User Sign-In* section and selecting the provider under the *Add sign-in Providers* section.

You may also register identity providers in *Amazon Cognito* console by selecting the related user pool and then accessing the *Federation > Identity providers* section.

## Google

* [AWS Developer Guide](http://docs.aws.amazon.com/cognito/latest/developerguide/google.html)
Expand Down
10 changes: 7 additions & 3 deletions packages/aws-amplify/src/Auth/Auth.ts
Expand Up @@ -138,11 +138,15 @@ export default class AuthClass {
onSuccess: (result) => {
that.user = that.userPool.getCurrentUser();
logger.debug("Cognito Hosted authentication result", result);
that.currentSession().then((session) => {
that._setCredentialsFromSession(session).then((cred) => {
that.currentSession().then(async (session) => {
try {
const cred = await that._setCredentialsFromSession(session);
logger.debug('sign in succefully with', cred);
} catch (e) {
logger.debug('sign in without aws credentials', e);
} finally {
dispatchAuthEvent('signIn', that.user);
});
}
});
},
onFailure: (err) => {
Expand Down

0 comments on commit c0b7b9e

Please sign in to comment.