Use Parcel2Go public API scope by default
Deploy HickLab3D Dashboard / Deploy to production (push) Successful in 1m1s
Deploy HickLab3D Dashboard / Deploy to production (push) Successful in 1m1s
This commit is contained in:
@@ -10,6 +10,16 @@ class Parcel2Go
|
||||
{
|
||||
public function __construct(private IntegrationSettings $settings) {}
|
||||
|
||||
public function hasScope(string $scope): bool
|
||||
{
|
||||
return in_array($scope, explode(' ', (string) ($this->settings->for('parcel2go')['scope'] ?? 'public-api')), true);
|
||||
}
|
||||
|
||||
public function verifyCredentials(): void
|
||||
{
|
||||
$this->accessToken();
|
||||
}
|
||||
|
||||
public function fetch(string $path): array
|
||||
{
|
||||
return Http::withToken($this->accessToken())->acceptJson()->connectTimeout(3)->timeout(15)
|
||||
@@ -104,7 +114,7 @@ class Parcel2Go
|
||||
|
||||
$token = Http::asForm()->timeout(10)->post($settings['auth_url'], [
|
||||
'grant_type' => 'client_credentials',
|
||||
'scope' => 'public-api my-profile',
|
||||
'scope' => $settings['scope'] ?? 'public-api',
|
||||
'client_id' => $settings['client_id'],
|
||||
'client_secret' => $settings['client_secret'],
|
||||
])->throw()->json('access_token');
|
||||
|
||||
Reference in New Issue
Block a user