Get userinfo given_name

tommi123
New Community Member

Hi guys,

 

We've been using login with PayPal functionality for our app in live environment for some time and we used profile information to fill the registration for users. We match first name and last name based on PayPal's given_name and family_name as described here https://developer.paypal.com/docs/api/identity/#openidconnect_userinfo

 

We discovered that we no longer receive given_name and family_name in response to GET userprofile request.

I checked scopes and my app settings and it doesn't seem to be changed. I'm adding all scopes described here: https://developer.paypal.com/docs/integration/direct/identity/attributes/

I'm able to receive other data, such as email, name, address of phone_number

 

Steps we use:

  1. Redirect user to https://www.sandbox.paypal.com/signin/authorize?client_id={my_sandbox_client_id}K&response_type=code...
  2. Make a POST request to /v1/identity/openidconnect/tokenservice 
    curl -X POST https://api.sandbox.paypal.com/v1/identity/openidconnect/tokenservice \              
      -H 'Authorization: Basic {base64 client_id:secret' \                                                                                                               
     -d 'grant_type=authorization_code&code={code_received_in_previous_step}'
  3. Make a GET request to /v1/identity/openidconnect/userinfo
    curl -v -X GET "https://api.sandbox.paypal.com/v1/identity/openidconnect/userinfo?schema=openid" \
    -H "Content-Type:application/json" \
    -H "Authorization: Bearer {code_received_in_previous_step}"

After that I receive JSON with address, language, verified, phone_number, locale, zoneinfo, email_verified, name, email, user_id fields, but there's no given_name and family_name fields.

 

Were there any changes in this API that I'm not aware of? I tried looking for it, but it's not described in any doc or on any forum I searched.

I'd appreciate any help.

 

Thanks,

Maciej

Login to Me Too
15 REPLIES 15

alexia13
Contributor
Contributor

Same here. It is still not working.

Login to Me Too

tarest
Contributor
Contributor

It works in django-allauth - I obtain:

 

{"user_id": "https://www.paypal.com/webapps/auth/identity/user/...", "name": "Firstname Lastname"}

 

so not only user_id but also name (and other information if I have right to obtain them).

Maybe try some other URLs?

Login to Me Too

alexia13
Contributor
Contributor

Yes, but then the API only retrieves the full name. So getting only the given_name (or first name) is still not possible.

Login to Me Too

narennaik
Contributor
Contributor

I have the same problem... can someone please provide a solution here

Login to Me Too

tsango
Contributor
Contributor

I am getting this issue also. No full name or email but I get address info

 

When calling 

 
All the options scope options are ticked in the app.
Login to Me Too

AymaneShadow
Contributor
Contributor

It's 2024 and this is still a problem. Sending a request to https://api-m.sandbox.paypal.com/v1/identity/oauth2/userinfo?schema=openid does not return "given_name" or "family_name". Here are my two cents about the PayPal docs related to integration:


Getting User Info

If you follow the instructions here https://developer.paypal.com/docs/log-in-with-paypal/integrate to get the user info I will explain what I think is problematic to me:

 

Enable Log in with PayPal

In step 5. there is no mention of "Full Name", and "given_name", and "family_name" are nowhere to be found. This should be added to let the developers know that they need to check this to get this info later.

 

Add Log in with PayPal button (to get Authorization Code)

Assuming you'e building your own button, if one follows the steps described here https://developer.paypal.com/docs/log-in-with-paypal/integrate/build-button/ to get the authorization code, this is the relevant step:

Step 1: ...
Step 2: Construct authorization endpoint using this template:
https://www.sandbox.paypal.com/signin/authorize?flowEntry=static&client_id=CLIENT-ID&scope=LIST-OF-S...
Step 3: ...
Step 4: ...

 

In this step, LIST-OF-SCOPES which is described in this webpage https://developer.paypal.com/docs/log-in-with-paypal/integrate/reference/#scope-attributes only has "Full Name", there is no "given_name" or "family_name". Why?

Furthermore, in this page in stackoverflow:

https://stackoverflow.com/questions/60045968/find-list-of-available-scopes-for-paypal-api

 

Some of the scopes mentioneed there - for example https://uri.paypal.com/payments/payouts - can be added to the list of scopes mentionned above and are valid even though they are not mentionned in https://developer.paypal.com/docs/log-in-with-paypal/integrate/reference/#scope-attributes . Why?

As you can see, there are some inconsistencies in the PayPal developer documentation and I would like to see them addressed. But for now, can someone tell us how to get the "given_name" and "family_name" of a user?

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.