@@ -65,26 +65,26 @@ |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | |
68 | - public function getAccessTokenFromAuthorizedCode(string $redirectUrl, string $code ): AccessToken |
|
69 | - { |
|
70 | - $options = [ |
|
71 | - 'form_params' => [ |
|
72 | - 'grant_type' => self::API_ACCESS_TOKEN_CODE_GRANT, |
|
73 | - 'client_id' => $this->clientId, |
|
74 | - 'client_secret' => $this->clientSecret, |
|
75 | - 'redirect_uri' => $redirectUrl, |
|
76 | - 'code' => $code |
|
77 | - ], |
|
78 | - ]; |
|
79 | - |
|
80 | - try { |
|
81 | - $this->setAccessToken($this->requestAccessToken(self::API_ACCESS_TOKEN_REQUEST_URL, $options)); |
|
82 | - } catch (ClientException $exception) { |
|
83 | - GuzzleClientExceptionHandler::handleClientException($exception); |
|
84 | - } |
|
85 | - |
|
86 | - return $this->accessToken; |
|
87 | - } |
|
68 | + public function getAccessTokenFromAuthorizedCode(string $redirectUrl, string $code ): AccessToken |
|
69 | + { |
|
70 | + $options = [ |
|
71 | + 'form_params' => [ |
|
72 | + 'grant_type' => self::API_ACCESS_TOKEN_CODE_GRANT, |
|
73 | + 'client_id' => $this->clientId, |
|
74 | + 'client_secret' => $this->clientSecret, |
|
75 | + 'redirect_uri' => $redirectUrl, |
|
76 | + 'code' => $code |
|
77 | + ], |
|
78 | + ]; |
|
79 | + |
|
80 | + try { |
|
81 | + $this->setAccessToken($this->requestAccessToken(self::API_ACCESS_TOKEN_REQUEST_URL, $options)); |
|
82 | + } catch (ClientException $exception) { |
|
83 | + GuzzleClientExceptionHandler::handleClientException($exception); |
|
84 | + } |
|
85 | + |
|
86 | + return $this->accessToken; |
|
87 | + } |
|
88 | 88 | |
89 | 89 | public function getAccessTokenFromUserLogin(string $username, string $password): AccessToken |
90 | 90 | { |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | const API_ACCESS_TOKEN_REQUEST_URL = self::API_BASE_URL . '/token'; |
16 | 16 | const API_ACCESS_TOKEN_PASSWORD_GRANT = 'password'; |
17 | - const API_ACCESS_TOKEN_CODE_GRANT = 'authorization_code'; |
|
17 | + const API_ACCESS_TOKEN_CODE_GRANT = 'authorization_code'; |
|
18 | 18 | const API_ACCESS_TOKEN_REFRESH_TOKEN_URL = self::API_BASE_URL . '/token'; |
19 | 19 | const API_ACCESS_TOKEN_REFRESH_TOKEN_GRANT = 'refresh_token'; |
20 | 20 |
@@ -68,29 +68,29 @@ |
||
68 | 68 | { |
69 | 69 | $scope = []; |
70 | 70 | if ($this->finance !== null) { |
71 | - $scope[] = $this->finance->getValue().':'.self::FINANCE; |
|
72 | - if($this->finance->getValue() == Rights::WRITE) |
|
73 | - $scope[] = Rights::READ.':'.self::FINANCE; |
|
71 | + $scope[] = $this->finance->getValue().':'.self::FINANCE; |
|
72 | + if($this->finance->getValue() == Rights::WRITE) |
|
73 | + $scope[] = Rights::READ.':'.self::FINANCE; |
|
74 | 74 | } |
75 | 75 | if ($this->purchase !== null) { |
76 | - $scope[] = $this->purchase->getValue().':'.self::PURCHASE; |
|
77 | - if($this->purchase->getValue() == Rights::WRITE) |
|
78 | - $scope[] = Rights::READ.':'.self::PURCHASE; |
|
76 | + $scope[] = $this->purchase->getValue().':'.self::PURCHASE; |
|
77 | + if($this->purchase->getValue() == Rights::WRITE) |
|
78 | + $scope[] = Rights::READ.':'.self::PURCHASE; |
|
79 | 79 | } |
80 | 80 | if ($this->product !== null) { |
81 | - $scope[] = $this->product->getValue().':'.self::PRODUCT; |
|
82 | - if($this->product->getValue() == Rights::WRITE) |
|
83 | - $scope[] = Rights::READ.':'.self::PRODUCT; |
|
81 | + $scope[] = $this->product->getValue().':'.self::PRODUCT; |
|
82 | + if($this->product->getValue() == Rights::WRITE) |
|
83 | + $scope[] = Rights::READ.':'.self::PRODUCT; |
|
84 | 84 | } |
85 | 85 | if ($this->inventory !== null) { |
86 | - $scope[] = $this->inventory->getValue().':'.self::INVENTORY; |
|
87 | - if($this->inventory->getValue() == Rights::WRITE) |
|
88 | - $scope[] = Rights::READ.':'.self::INVENTORY; |
|
86 | + $scope[] = $this->inventory->getValue().':'.self::INVENTORY; |
|
87 | + if($this->inventory->getValue() == Rights::WRITE) |
|
88 | + $scope[] = Rights::READ.':'.self::INVENTORY; |
|
89 | 89 | } |
90 | 90 | if ($this->image !== null) { |
91 | - $scope[] = $this->image->getValue().':'.self::IMAGE; |
|
92 | - if($this->image->getValue() == Rights::WRITE) |
|
93 | - $scope[] = Rights::READ.':'.self::IMAGE; |
|
91 | + $scope[] = $this->image->getValue().':'.self::IMAGE; |
|
92 | + if($this->image->getValue() == Rights::WRITE) |
|
93 | + $scope[] = Rights::READ.':'.self::IMAGE; |
|
94 | 94 | } |
95 | 95 | return implode(' ', $scope); |
96 | 96 | } |