-
-
Notifications
You must be signed in to change notification settings - Fork 120
Expand file tree
/
Copy pathGetRefreshTokenRequest.php
More file actions
62 lines (54 loc) · 1.39 KB
/
GetRefreshTokenRequest.php
File metadata and controls
62 lines (54 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
declare(strict_types=1);
namespace Saloon\Http\OAuth2;
use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Contracts\Body\HasBody;
use Saloon\Traits\Body\HasFormBody;
use Saloon\Helpers\OAuth2\OAuthConfig;
use Saloon\Traits\Plugins\AcceptsJson;
/**
* @extends Request<null>
*/
class GetRefreshTokenRequest extends Request implements HasBody
{
use HasFormBody;
use AcceptsJson;
/**
* Define the method that the request will use.
*/
protected Method $method = Method::POST;
/**
* Define the endpoint for the request.
*/
public function resolveEndpoint(): string
{
return $this->oauthConfig->getTokenEndpoint();
}
/**
* Requires the authorization code and OAuth 2 config.
*/
public function __construct(protected OAuthConfig $oauthConfig, protected string $refreshToken)
{
//
}
/**
* Register the default data.
*
* @return array{
* grant_type: string,
* refresh_token: string,
* client_id: string,
* client_secret: string,
* }
*/
public function defaultBody(): array
{
return [
'grant_type' => 'refresh_token',
'refresh_token' => $this->refreshToken,
'client_id' => $this->oauthConfig->getClientId(),
'client_secret' => $this->oauthConfig->getClientSecret(),
];
}
}