forked from LiveCarta/PayPal-PHP-SDK
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
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@ First, you need to obtain user's consent to retrieve the information you wan
|
||||
This is explained in the example "ObtainUserConsent.php".</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Once you get the user's consent, the end result would be long lived refresh token.
|
||||
This refresh token should be stored in a permanent storage for later use.</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Lastly, when you need to retrieve the user information, you need to generate the short lived access token
|
||||
to retreive the information. The short lived access token can be retrieved using the example shown in
|
||||
"GenerateAccessTokenFromRefreshToken.php", or as shown below</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>You can retrieve the refresh token by executing ObtainUserConsent.php and store the refresh token</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$refreshToken</span> = <span class="hljs-string">'yzX4AkmMyBKR4on7vB5he-tDu38s24Zy-kTibhSuqA8kTdy0Yinxj7NpAyULx0bxqC5G8dbXOt0aVMlMmtpiVmSzhcjVZhYDM7WUQLC9KpaXGBHyltJPkLLQkXE'</span>;
|
||||
"GenerateAccessTokenFromRefreshToken.php", or as shown below</p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>You can retrieve the refresh token by executing ObtainUserConsent.php and store the refresh token</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$refreshToken</span> = <span class="hljs-string">'W1JmxG-Cogm-4aSc5Vlen37XaQTj74aQcQiTtXax5UgY7M_AJ--kLX8xNVk8LtCpmueFfcYlRK6UgQLJ-XHsxpw6kZzPpKKccRQeC4z2ldTMfXdIWajZ6CHuebs'</span>;
|
||||
|
||||
<span class="hljs-keyword">try</span> {
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
<p>The clientId is stored in the bootstrap file</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">//Get Authorization URL returns the redirect URL that could be used to get user's consent</span>
|
||||
<span class="hljs-variable">$redirectUrl</span> = OpenIdSession::getAuthorizationUrl(
|
||||
<span class="hljs-variable">$baseUrl</span>,
|
||||
<span class="hljs-keyword">array</span>(<span class="hljs-string">'profile'</span>, <span class="hljs-string">'email'</span>, <span class="hljs-string">'phone'</span>),
|
||||
<span class="hljs-keyword">array</span>(<span class="hljs-string">'openid'</span>, <span class="hljs-string">'profile'</span>, <span class="hljs-string">'address'</span>, <span class="hljs-string">'email'</span>, <span class="hljs-string">'phone'</span>,
|
||||
<span class="hljs-string">'https://uri.paypal.com/services/paypalattributes'</span>, <span class="hljs-string">'https://uri.paypal.com/services/expresscheckout'</span>),
|
||||
<span class="hljs-keyword">null</span>,
|
||||
<span class="hljs-keyword">null</span>,
|
||||
<span class="hljs-keyword">null</span>,
|
||||
|
||||
@@ -18,7 +18,7 @@ use PayPal\Api\OpenIdTokeninfo;
|
||||
// "GenerateAccessTokenFromRefreshToken.php", or as shown below
|
||||
|
||||
// You can retrieve the refresh token by executing ObtainUserConsent.php and store the refresh token
|
||||
$refreshToken = 'yzX4AkmMyBKR4on7vB5he-tDu38s24Zy-kTibhSuqA8kTdy0Yinxj7NpAyULx0bxqC5G8dbXOt0aVMlMmtpiVmSzhcjVZhYDM7WUQLC9KpaXGBHyltJPkLLQkXE';
|
||||
$refreshToken = 'W1JmxG-Cogm-4aSc5Vlen37XaQTj74aQcQiTtXax5UgY7M_AJ--kLX8xNVk8LtCpmueFfcYlRK6UgQLJ-XHsxpw6kZzPpKKccRQeC4z2ldTMfXdIWajZ6CHuebs';
|
||||
|
||||
try {
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@ $baseUrl = getBaseUrl() . '/UserConsentRedirect.php?success=true';
|
||||
//Get Authorization URL returns the redirect URL that could be used to get user's consent
|
||||
$redirectUrl = OpenIdSession::getAuthorizationUrl(
|
||||
$baseUrl,
|
||||
array('profile', 'email', 'phone'),
|
||||
array('openid', 'profile', 'address', 'email', 'phone',
|
||||
'https://uri.paypal.com/services/paypalattributes', 'https://uri.paypal.com/services/expresscheckout'),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
|
||||
Reference in New Issue
Block a user