This repository has been archived on 2026-04-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
PayPal-PHP-SDK/sample/lipp/ObtainUserConsent.php
Jay Patel 2cb32696d8 Identity API Samples to include all scopes
- Obtain User Consent now show all possible scopes
- Get User Info now has all the fields shown for demonstration purposes
2015-02-18 13:14:33 -06:00

24 lines
765 B
PHP

<?php
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\OpenIdSession;
$baseUrl = getBaseUrl() . '/UserConsentRedirect.php?success=true';
// ### Get User Consent URL
// The clientId is stored in the bootstrap file
//Get Authorization URL returns the redirect URL that could be used to get user's consent
$redirectUrl = OpenIdSession::getAuthorizationUrl(
$baseUrl,
array('openid', 'profile', 'address', 'email', 'phone',
'https://uri.paypal.com/services/paypalattributes', 'https://uri.paypal.com/services/expresscheckout'),
null,
null,
null,
$apiContext
);
ResultPrinter::printResult("Generated the User Consent URL", "URL", '<a href="'. $redirectUrl . '" >Click Here to Obtain User Consent</a>', $baseUrl, $redirectUrl);