Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
name: profile.getName(),
picture: profile.getImageUrl(),
};
const { onStateChange } = this.props;
if (
!Auth ||
typeof Auth.federatedSignIn !== 'function' ||
typeof Auth.currentAuthenticatedUser !== 'function'
) {
throw new Error(
'No Auth module found, please ensure @aws-amplify/auth is imported'
);
}
await Auth.federatedSignIn(
'google',
{ token: id_token, expires_at },
user
);
user = await Auth.currentAuthenticatedUser();
if (onStateChange) {
onStateChange('signedIn', user);
}
}
signIn(_e, provider) {
Auth.federatedSignIn({ provider });
}
this._auth0.client.userInfo(authResult.accessToken, (err, user) => {
let username = undefined;
let email = undefined;
if (err) {
logger.debug('Failed to get the user info', err);
} else {
username = user.name;
email = user.email;
}
Auth.federatedSignIn(
config.domain,
{
token: authResult.idToken,
expires_at: authResult.expiresIn * 1000 + new Date().getTime(),
},
{ name: username, email }
)
.then(() => {
if (onStateChange) {
Auth.currentAuthenticatedUser().then(user => {
onStateChange('signedIn', user);
});
}
})
.catch(e => {
logger.debug('Failed to get the aws credentials', e);
fb.api('/me', { fields: 'name,email' }, response => {
const user = {
name: response.name,
email: response.email,
};
if (
!Auth ||
typeof Auth.federatedSignIn !== 'function' ||
typeof Auth.currentAuthenticatedUser !== 'function'
) {
throw new Error(
'No Auth module found, please ensure @aws-amplify/auth is imported'
);
}
Auth.federatedSignIn(
'facebook',
{ token: accessToken, expires_at },
user
)
.then(credentials => {
return Auth.currentAuthenticatedUser();
})
.then(authUser => {
if (onStateChange) {
onStateChange('signedIn', authUser);
}
});
});
}
this._auth0.client.userInfo(authResult.accessToken, (err, user) => {
let username = undefined;
let email = undefined;
if (err) {
logger.debug('Failed to get the user info', err);
} else {
username = user.name;
email = user.email;
}
Auth.federatedSignIn(
config.domain,
{
token: authResult.idToken,
expires_at: authResult.expiresIn * 1000 + new Date().getTime()
},
{ name: username, email }
).then((cred) => {
if (onStateChange) {
Auth.currentAuthenticatedUser().then(user => {
onStateChange('signedIn', user);
});
}
}).catch((e) => {
logger.debug('Failed to get the aws credentials', e);
if (onError) onError(e);
});
const user = {
name: userInfo.profile.Name,
email: userInfo.profile.PrimaryEmail,
};
if (
!Auth ||
typeof Auth.federatedSignIn !== 'function' ||
typeof Auth.currentAuthenticatedUser !== 'function'
) {
throw new Error(
'No Auth module found, please ensure @aws-amplify/auth is imported'
);
}
Auth.federatedSignIn(
'amazon',
{ token: access_token, expires_at },
user
)
.then(credentials => {
return Auth.currentAuthenticatedUser();
})
.then(authUser => {
if (onStateChange) {
onStateChange('signedIn', authUser);
}
});
});
}