composer require socialiteproviders/sapoid
Please see the Base Installation Guide, then follow the provider specific instructions below.
'sapoid' => [
'client_id' => env('SAPOID_CLIENT_ID'),
'client_secret' => env('SAPOID_CLIENT_SECRET'),
'redirect' => env('SAPOID_REDIRECT_URI'),
],
In Laravel 11, the default EventServiceProvider
provider was removed. Instead, add the listener using the listen
method on the Event
facade, in your AppServiceProvider
boot
method.
- Note: You do not need to add anything for the built-in socialite providers unless you override them with your own providers.
Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
$event->extendSocialite('sapoid', \SocialiteProviders\SapoId\Provider::class);
});
Laravel 10 or below
Configure the package's listener to listen for `SocialiteWasCalled` events.Add the event to your listen[]
array in app/Providers/EventServiceProvider
. See the Base Installation Guide for detailed instructions.
protected $listen = [
\SocialiteProviders\Manager\SocialiteWasCalled::class => [
// ... other providers
\SocialiteProviders\SapoId\SapoIdExtendSocialite::class.'@handle',
],
];
To configure your app in SAPO ID, you need to create an app in the SAPO ID Connect and get the client ID and client secret.
You should now be able to use the provider like you would regularly use Socialite (assuming you have the facade installed):
return Socialite::driver('sapoid')->redirect();
To add more scopes you can use the below:
return Socialite::driver('sapoid')->scopes(['add','scopes','here'])->redirect();
Available scopes:
email
: provides access to user emailprofile
: provides access to user name and avatar
Access to these scopes must be configured per app in its config page: https://id.sapo.pt/connect/
The default scope only has the id
, other scopes are needed for name
, email
and avatar
id
: (string) The unique identifier for the user in SAPO ID.name
: (string|null) The full name of the user.email
: (string|null) The email address of the user.avatar
: (string|null) The URL of the user's avatar image.