Allegro OAuth2 Provider for Laravel Socialite.
- PHP >=7.4
composer require mnastalski/allegro-socialite
'allegro' => [
'client_id' => env('ALLEGRO_CLIENT_ID'),
'client_secret' => env('ALLEGRO_CLIENT_SECRET'),
'redirect' => env('ALLEGRO_REDIRECT'),
],
To make sandbox mode configurable you can add the following to the above configuration:
'sandbox' => env('ALLEGRO_SANDBOX', false),
use Laravel\Socialite\Facades\Socialite;
$provider = Socialite::driver('allegro');
$provider->redirect();
$provider->user();
$provider->getAccessToken();
For $provider->user()
to work the allegro:api:profile:read
permission must be granted.
Socialite::driver('allegro')->getRefreshTokenResponse($refreshToken);
Example response:
[
'access_token' => '...',
'token_type' => 'bearer',
'refresh_token' => '...',
'expires_in' => 43199,
'scope' => 'allegro:api:profile:read',
'allegro_api' => true,
'jti' => '...',
]