How to connect Paypal social login for android on the server side

nosun
Contributor
Contributor

Hello, we have recently developed an app, and hope to add paypal social login on the app.

 

At present, the auth code can be obtained on the app and then sent to the server side. Reference to the existing document, We use paypal php sdk and sends a request to the paypal server side, try to get the user info, but got the 401 code.

 

Can you tell me what went wrong and how can I solve this problem.

 

Below is the example code of server side:

 


$token = "C21AAHORF86kalL6fONGqC8QBySW-5r8IEx9HElGHzgmXK8XVSAc9iegs2R-_4Ami5FwhrwFtNGZR0LorOYf9u4l19QLGBJ6Q" // auth code from app
$client_id = config('services.paypal_sandbox.client_id');
$client_secret = config('services.paypal_sandbox.client_secret');

$apiContext = new ApiContext(new OAuthTokenCredential($client_id, $client_secret));

$apiContext->setConfig([
'mode' => 'sandbox',
'log.LogEnabled' => true,
'log.FileName' => '/tmp/PayPal.log',
'log.LogLevel' => 'DEBUG'
]);

$params = array('access_token' => $token);

$userInfo = OpenIdUserinfo::getUserinfo($params, $apiContext);

var_dump($userInfo);die;

 

 

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

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