Want to get data from the given_name and family_name, django

Hello

I have just started to try out the Auth0 with Django.
For now I am able to log in, and can se basic data.
(Follow this guides.
Django Tutorial: Building and Securing Web Applications and
Auth0 Django SDK Quickstarts: Login)

Now, i would like to get the given_name and family_name.

In my settings.py i have defined this:

SOCIAL_AUTH_AUTH0_SCOPE = [
‘openid’,
‘profile’,
‘email’,
‘given_name’,
‘family_name’,
]

And my views.py:

def dashboard(request):

user = request.user
auth0user = user.social_auth.get(provider='auth0')
userdata = {
    'user_id': auth0user.uid,
    'name': user.first_name,
    'picture': auth0user.extra_data['picture'],
    'email': auth0user.extra_data['email'],
}

Here i have tried to add family_name and given_name using auth0.given_name and auth0.family_name.

Altso tried with the auth0user.extra_data['family_name].

So, can some one point me in the right direction here, so i`m albe to show that data?

Thanks!

Assuming this is an authentication flow in the scope of an OIDC conformant application, which is likely a safe assumption as that’s been the default for some time, you can remove the given_name and family_name scopes because those are not standard OIDC scopes so they won’t have any impact unless you have rules reacting to those.

The OIDC standard scopes can be fount at (Final: OpenID Connect Core 1.0 incorporating errata set 1); the profile scope is the one that signals you want information like given and family name to be returned so using that one should be sufficient.

Since you’re requesting profile scope already as a first step you should first check if the user with which you’re logging in as the name information (given_name and family_name attributes) set in the profile available in the Auth0 dashboard. If that information is not available in those specific fields then it won’t even be returned so this would be the first step.