Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth0 profile image #4329

Merged
merged 7 commits into from Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/auth/src/types/Auth.ts
Expand Up @@ -119,6 +119,7 @@ export interface FederatedResponse {
export interface FederatedUser {
name: string;
email?: string;
picture?: string;
}

export interface AwsCognitoOAuthOpts {
Expand Down
8 changes: 7 additions & 1 deletion packages/aws-amplify-react/src/Auth/Provider/withAuth0.tsx
Expand Up @@ -101,11 +101,13 @@ export default function withAuth0(Comp, options?) {
this._auth0.client.userInfo(authResult.accessToken, (err, user) => {
let username = undefined;
let email = undefined;
let picture = undefined;
if (err) {
logger.debug('Failed to get the user info', err);
} else {
username = user.name;
email = user.email;
picture = user.picture;
}

Auth.federatedSignIn(
Expand All @@ -114,7 +116,11 @@ export default function withAuth0(Comp, options?) {
token: authResult.idToken,
expires_at: authResult.expiresIn * 1000 + new Date().getTime(),
},
{ name: username, email }
{
name: username,
email,
picture,
}
)
.then(() => {
if (onStateChange) {
Expand Down