Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Commit

Permalink
adding target subject to the generate access token call
Browse files Browse the repository at this point in the history
  • Loading branch information
rohit basu committed Dec 11, 2018
1 parent ff2a7f9 commit c227b02
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/PayPal/Auth/OAuthTokenCredential.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ class OAuthTokenCredential extends PayPalResourceModel
*/
private $clientSecret;

/**
* Target subject
*/
private $targetSubject;

/**
* Generated Access Token
*
Expand Down Expand Up @@ -81,11 +86,12 @@ class OAuthTokenCredential extends PayPalResourceModel
* @param string $clientId client id obtained from the developer portal
* @param string $clientSecret client secret obtained from the developer portal
*/
public function __construct($clientId, $clientSecret)
public function __construct($clientId, $clientSecret, $targetSubject = null)
{
$this->clientId = $clientId;
$this->clientSecret = $clientSecret;
$this->cipher = new Cipher($this->clientSecret);
$this->targetSubject = $targetSubject;
}

/**
Expand Down Expand Up @@ -267,6 +273,9 @@ private function generateAccessToken($config, $refreshToken = null)
$params['grant_type'] = 'refresh_token';
$params['refresh_token'] = $refreshToken;
}
if ($this->targetSubject != null) {
$params['target_subject'] = $this->targetSubject;
}
$payload = http_build_query($params);
$response = $this->getToken($config, $this->clientId, $this->clientSecret, $payload);

Expand Down

0 comments on commit c227b02

Please sign in to comment.