How to use/receive the user's name as "first name" and "last name" instead of the full name? #849
-
Your question What are you trying to do
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
This is an example of retrieving the first_name, and last_name from Facebook
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 documentation to be sure. Be sure to check the default settings of each provider. https://github.com/nextauthjs/next-auth/tree/main/src/providers |
Beta Was this translation helpful? Give feedback.
-
where can i find the profileUrl for other providers ?? |
Beta Was this translation helpful? Give feedback.
-
The option profile callback NextAuth Provider, if you add more custom user information to be saved on the database like @iandjx example, once it got inserted to the database. In the next login with the same OAuth Provider, how can you update its details if there are any changes since the creation of the user is handled here? |
Beta Was this translation helpful? Give feedback.
-
Can anyone help with getting the user first and last name from facebook provider, for v5? The profileUrl seems not available anymore in v5, however there's userinfo, I tried the following but it didn't work: Facebook({
clientId: process.env.FACEBOOK_CLIENT_ID,
clientSecret: process.env.FACEBOOK_CLIENT_SECRET,
allowDangerousEmailAccountLinking: true,
userinfo: {
URL: "https://graph.facebook.com/me?fields=id,name,email,picture,first_name,last_name",
},
profile: (profile: FacebookProfile) => {
return {
id: profile.id,
name: profile.name,
firstName: profile.first_name,
lastName: profile.last_name,
email: profile.email,
image: profile.picture.data.url,
};
},
}), |
Beta Was this translation helpful? Give feedback.
This is an example of retrieving the first_name, and last_name from Facebook
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…