Skip to content

How to use/receive the user's name as "first name" and "last name" instead of the full name? #849

Answered by iandjx
alexandrepaiva-dev asked this question in Help
Discussion options

You must be logged in to vote

This is an example of retrieving the first_name, and last_name from Facebook

    Providers.Facebook({
      clientId: process.env.FACEBOOK_CLIENT_ID,
      clientSecret: process.env.FACEBOOK_CLIENT_SECRET,
      profileUrl:
        "https://graph.facebook.com/me?fields=email,first_name,last_name",
      profile: (_profile) => {
        return {
          id: _profile.id,
          firstName: _profile.first_name,
          lastName: _profile.last_name,
          email: _profile.email,
        };
      },
    }),

We should overwrite the profileUrl with the fields we want returned. The profile url and the fields available will be different for every OAuth provider, so check their documentat…

Replies: 4 comments 6 replies

Comment options

You must be logged in to vote
2 replies
@taha-khoumani
Comment options

@SChoumiloff
Comment options

Answer selected by balazsorban44
Comment options

You must be logged in to vote
1 reply
@bperun123
Comment options

Comment options

You must be logged in to vote
2 replies
@iandjx
Comment options

@JamesDelfini
Comment options

Comment options

You must be logged in to vote
1 reply
@themilkman1770
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
9 participants
Converted from issue

This discussion was converted from issue #849 on December 07, 2020 16:49.