Skip to content

Commit

Permalink
Merge pull request #710 from powerful23/hosted-ui-fix
Browse files Browse the repository at this point in the history
Allow user sign in by Cognito hosted ui without credentials
  • Loading branch information
richardzcode committed Apr 23, 2018
2 parents 12d99dc + 3231754 commit 257a41a
Showing 1 changed file with 7 additions and 3 deletions.
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 257a41a

Please sign in to comment.