summaryrefslogtreecommitdiff
path: root/vendor/league/oauth2-client/src/Grant/RefreshToken.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/league/oauth2-client/src/Grant/RefreshToken.php')
-rw-r--r--vendor/league/oauth2-client/src/Grant/RefreshToken.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/vendor/league/oauth2-client/src/Grant/RefreshToken.php b/vendor/league/oauth2-client/src/Grant/RefreshToken.php
new file mode 100644
index 0000000..86e7f6e
--- /dev/null
+++ b/vendor/league/oauth2-client/src/Grant/RefreshToken.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace League\OAuth2\Client\Grant;
+
+use League\OAuth2\Client\Token\AccessToken as AccessToken;
+
+class RefreshToken implements GrantInterface
+{
+ public function __toString()
+ {
+ return 'refresh_token';
+ }
+
+ public function prepRequestParams($defaultParams, $params)
+ {
+ if (! isset($params['refresh_token']) || empty($params['refresh_token'])) {
+ throw new \BadMethodCallException('Missing refresh_token');
+ }
+
+ $params['grant_type'] = 'refresh_token';
+
+ return array_merge($defaultParams, $params);
+ }
+
+ public function handleResponse($response = [])
+ {
+ return new AccessToken($response);
+ }
+}