-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from codebar-ag/fix-refresh-token
Refresh Access Token
- Loading branch information
Showing
5 changed files
with
317 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/Requests/Authentication/GetRefreshAccessTokenRequest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CodebarAg\LaravelInstagram\Requests\Authentication; | ||
|
||
use Saloon\Enums\Method; | ||
use Saloon\Http\Request; | ||
use Saloon\Traits\Plugins\AcceptsJson; | ||
|
||
class GetRefreshAccessTokenRequest extends Request | ||
{ | ||
use AcceptsJson; | ||
|
||
/** | ||
* Define the method that the request will use. | ||
*/ | ||
protected Method $method = Method::GET; | ||
|
||
/** | ||
* Define the endpoint for the request. | ||
*/ | ||
public function resolveEndpoint(): string | ||
{ | ||
return 'https://graph.instagram.com/refresh_access_token'; | ||
} | ||
|
||
/** | ||
* Requires the authorization code and OAuth 2 config. | ||
*/ | ||
public function __construct(protected string $code) {} | ||
|
||
/** | ||
* Register the default data. | ||
* | ||
* @return array{ | ||
* grant_type: string, | ||
* access_token: string, | ||
* } | ||
*/ | ||
public function defaultQuery(): array | ||
{ | ||
return [ | ||
'grant_type' => 'ig_refresh_token', | ||
'access_token' => $this->code, | ||
]; | ||
} | ||
} |
Oops, something went wrong.