This documentation is for an upcoming version and is subject to change.
Add this in config/services.php:
'github' => [ 'client_id' => env('GITHUB_CLIENT_ID'), 'client_secret' => env('GITHUB_CLIENT_SECRET'), 'redirect' => env('GITHUB_REDIRECT') ?? env('APP_URL') . '/socialite-extender/callback/github', 'token_url' => env('GITHUB_TOKEN_URL', 'https://github.com/login/oauth/access_token'), 'scopes' => ['read:user'], ],
SocialAccount Modelredirect($provider) - redirects to the OAuth provider for authentication.callback($provider) - saves or updates tokens for the logged-in user.disconnect($provider) - removes the provider connection.use Zaimea\SocialiteExtender\Models\SocialAccount; use Zaimea\SocialiteExtender\Services\SocialApiClient; $account = SocialAccount::find($id); $response = SocialApiClient::request($account, 'get', 'https://api.github.com/user'); if ($response->ok()) { $data = $response->json(); }
You can connect any provider supported by Socialite (Google, Facebook, etc.) --- just change the provider in the route and config.
Tokens are securely stored and linked to the authenticated user. Use the same model pattern for any provider.
For issues or suggestions: GitHub Issues