# Usos
composer require socialiteproviders/usos
# Installation & Basic Usage
Please see the Base Installation Guide (opens new window), then follow the provider specific instructions below.
# Add configuration to config/services.php
'usos' => [
'domain' => env('USOS_DOMAIN_URL'), // Because of every instance of USOS is self-hosted
'client_id' => env('USOS_CLIENT_ID'),
'client_secret' => env('USOS_CLIENT_SECRET'),
'redirect' => env('USOS_REDIRECT_URI')
],
As a default, provider loads only necessary for Socialite data. If you need to get more data during authentication process, such as student status or phone number, you may add profile_fields_selector
parameter:
'usos' => [
// ...
'profile_fields_selector' => env('USOS_PROFILE_FIELDS_SELECTOR'),
// ...
]
Some fields may be not available without scopes
field specifying.
# Add provider event listener
# Laravel 11+
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('usos', \SocialiteProviders\Usos\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 (opens new window) for detailed instructions.
protected $listen = [
\SocialiteProviders\Manager\SocialiteWasCalled::class => [
// ... other providers
\SocialiteProviders\Usos\UsosExtendSocialite::class.'@handle',
],
];
# Usage
You should now be able to use the provider like you would regularly use Socialite (assuming you have the facade installed):
return Socialite::driver('usos')->redirect();
You also can use USOS scopes via Socialite scopes
method:
return Socialite::driver('usos')
->scopes(['personal', 'email'])
->redirect();
To get more information about scopes
you may visit a documentation page at yours USOS instance, or at the USOSapi Mother server webpage (opens new window).
← SURFconext Xing →