Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Socialite Laravel Package

laravel/socialite

Laravel Socialite provides a fluent OAuth authentication interface for Laravel, with built-in drivers for Bitbucket, Facebook, GitHub, GitLab, Google, LinkedIn, Slack, Twitch, and X. Handles the boilerplate for social login and user retrieval.

View on GitHub
Deep Wiki
Context7

Laravel wrapper around OAuth 1 & OAuth 2 libraries.

Frequently asked questions about Socialite
How do I install Laravel Socialite in my Laravel project?
Run `composer require laravel/socialite` to install the package. No additional steps are required for basic setup, though you’ll need to configure your OAuth credentials in `config/services.php` for each provider you use.
Which Laravel versions does Socialite support?
Socialite is officially supported on Laravel 10.x and 11.x. Check the [Laravel documentation](https://laravel.com/docs/socialite) for version-specific compatibility details, as some OAuth providers may require updates for newer Laravel releases.
Can I use Socialite for OAuth 1.0 providers like Twitter/X?
Yes, Socialite supports OAuth 1.0 providers, including Twitter/X. However, Twitter’s API transition to OAuth 2.0 may require additional configuration. Always verify provider-specific documentation for breaking changes.
How do I handle user data mapping after OAuth authentication?
Socialite retrieves user data (e.g., email, avatar) from the provider. You can map this data to your Laravel user model using the `findOrCreateUser` method or manually create/update users in the `handleProviderCallback` method.
Does Socialite support refresh tokens for OAuth 2.0 providers?
Socialite does not natively handle refresh tokens. You’ll need to implement custom logic to store and rotate tokens, typically using Laravel’s cache or a database table like `oauth_refresh_tokens`.
How can I test Socialite authentication without hitting real OAuth endpoints?
Use Socialite’s `FakeProvider` for unit testing. Replace the real provider with a fake instance in your tests to simulate successful or failed authentication flows without external API calls.
What if my required OAuth provider isn’t included in Socialite?
Socialite no longer accepts new adapters, but you can use the community-driven [Socialite Providers](https://socialiteproviders.com/) for niche platforms like Discord or Reddit. For unsupported providers, you may need to extend `AbstractProvider` or build a custom solution.
How do I secure Socialite callbacks to prevent CSRF attacks?
Socialite relies on Laravel’s built-in CSRF protection. Ensure your callback routes (e.g., `/auth/callback`) are signed using `Route::middleware('signed')` and that the `state` parameter is validated using `hash_equals` for security.
Can I use Socialite with Laravel’s Sanctum or Passport for API authentication?
Yes, Socialite can integrate with Sanctum or Passport. After authenticating a user via Socialite, you can issue API tokens using Sanctum’s `createToken` or Passport’s `issueToken` methods to enable stateless API access.
What are the performance implications of Socialite in production?
Socialite adds minimal overhead, as it delegates heavy lifting to the OAuth provider. However, token storage (e.g., refresh tokens) and user data mapping can impact performance if not optimized. Cache frequently accessed user data or use database indexes for large-scale apps.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony