1. Go to this page and download the library: Download wotz/socialite-zenith library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Laravel\Socialite\Facades\Socialite;
Route::get('/auth/zenith/redirect', fn () => Socialite::driver('zenith')->redirect());
Route::get('/auth/zenith/callback', function () {
$zenithUser = Socialite::driver('zenith')->user();
$zenithUser->getId(); // Zenith user id, as a string
$zenithUser->getName(); // "firstname lastname"
$zenithUser->getEmail();
$zenithUser->getRaw(); // the full `data` object from /api/user/current
});
use Illuminate\Http\Client\RequestException;
try {
$zenithUser = Socialite::driver('zenith')->user();
} catch (RequestException $exception) {
if ($exception->response->forbidden()) {
// deactivated in Zenith
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.