Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(credentials => {
return Auth.currentAuthenticatedUser();
})
.then(authUser => {
}
const { id_token, expires_at } = user.getAuthResponse();
const profile = user.getBasicProfile();
await Auth.federatedSignIn(
'google',
{ token: id_token, expires_at },
{
email: profile.getEmail(),
name: profile.getName(),
picture: profile.getImageUrl(),
},
);
const authenticatedUser = await Auth.currentAuthenticatedUser();
try {
this.handleAuthStateChange(AuthState.SignedIn, authenticatedUser);
} catch (error) {
this.handleError(error);
}
};
logger.debug('Failed to get the user info', err);
} else {
username = user.name;
email = user.email;
}
await Auth.federatedSignIn(
config.domain,
{
token: authResult.idToken,
expires_at: authResult.expiresIn * 1000 + new Date().getTime(),
},
{ name: username, email },
);
const authenticatedUser = await Auth.currentAuthenticatedUser();
this.handleAuthStateChange(AuthState.SignedIn, authenticatedUser);
});
});
window['FB'].api('/me', { fields }, async response => {
const user = {
name: response.name,
email: response.email,
};
await Auth.federatedSignIn('facebook', { token: accessToken, expires_at }, user);
const authenticatedUser = await Auth.currentAuthenticatedUser();
this.handleAuthStateChange(AuthState.SignedIn, authenticatedUser);
});
};
.then(credentials => {
return Auth.currentAuthenticatedUser();
})
.then(authUser => {
window['amazon'].Login.retrieveProfile(async userInfo => {
if (!userInfo.success) {
return logger.debug('Get user Info failed');
}
const user = {
name: userInfo.profile.Name,
email: userInfo.profile.PrimaryEmail,
};
await Auth.federatedSignIn('amazon', { token: access_token, expires_at }, user);
const authenticatedUser = await Auth.currentAuthenticatedUser();
this.handleAuthStateChange(AuthState.SignedIn, authenticatedUser);
});
};