How to connect Paypal social login for android on the server side
nosun
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Jun-29-2020
04:57 AM
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;
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.
Related Content
- "System error. Please try again later" when connecting to paypal sandbox account with my android app in Sandbox Environment
- How to integrate PayPal during user signup to avoid re-entering credentials for future payments? in REST APIs
- I cant connect using pilot-payflowpro.paypal.com:443 using the PayFlow API it was working prior in Payflow
- Issue with Payflow Pro: "Failed to connect to host" Error on Server Deployment in Payflow
- Android WebViews issue when doing seller onboarding in REST APIs