- How do I install socialiteproviders/gitlab in Laravel?
- Run composer require socialiteproviders/gitlab, then register the SocialiteWasCalled listener for GitLabExtendSocialite unless your Laravel version auto-discovers it. Add your GitLab OAuth credentials to config/services.php and clear the config cache. Test the redirect and callback flow in a non-production environment before rollout.
- Which Laravel, PHP, and Socialite versions does this GitLab provider support?
- No current support matrix is provided in the package context, and the last release was on 2020-12-01. You must run a dependency-resolution spike against your target Laravel, PHP, and Socialite versions. Pin compatible versions and test the full OAuth handshake before committing to production.
- Does this package support self-managed GitLab instances?
- The provider is built for GitLab OAuth, but self-managed support depends on whether it exposes a configurable GitLab instance or base URL. GitLab.com is the common default target; for a self-managed instance, verify the provider config in source and test TLS, callback URLs, and certificate trust. Run a staging validation against your own GitLab instance before relying on it.
- How do I configure the GitLab client ID, secret, and scopes?
- Add gitlab credentials to config/services.php, including client_id, client_secret, redirect, and any required scopes. Keep secrets in environment variables and use separate GitLab OAuth applications per environment. After changing configuration, clear Laravel's config cache and confirm the callback URL exactly matches the GitLab application settings.
- How do I register the Socialite provider listener in Laravel?
- Add a listener for SocialiteProviders\Manager\SocialiteWasCalled that calls GitLabExtendSocialite, typically in EventServiceProvider. Some package versions may rely on auto-discovery, so verify your installed version's registration requirements. Once registered, Socialite::driver('gitlab') should resolve the GitLab provider.
- What routes and callback URL do I need for GitLab login?
- Create routes for redirect and callback, such as /auth/gitlab/redirect and /auth/gitlab/callback, and set the callback URL in your GitLab OAuth application to match each environment. The redirect route calls Socialite::driver('gitlab')->redirect(), and the callback route calls ->user(). Log callback and token-exchange failures without leaking client secrets or tokens.
- How do I map the returned GitLab user to a local Laravel user?
- Socialite returns a user object with the GitLab ID, nickname, name, email, and avatar. Match existing accounts by stored provider ID first; only link by email when the email is verified and your account-linking policy allows it. Store the GitLab provider ID in a social accounts table and avoid unsafe auto-linking on unverified email.
- Does this package support PKCE, state validation, refresh tokens, or private email?
- State handling is generally part of Socialite's OAuth flow, but PKCE and refresh-token support are not guaranteed by this thin GitLab adapter. Private-email behavior depends on requested scopes and the user's GitLab settings, so handle a missing email explicitly. Verify all of these in the provider source and upstream SocialiteProviders repository before relying on them.
- Is socialiteproviders/gitlab actively maintained and safe for production?
- Treat it as community-supported with no SLA: the last release was 2020-12-01 and the repository is a read-only subtree split of SocialiteProviders/Providers. Track upstream activity and be prepared to pin, fork, or use a Composer VCS override for urgent patches. Run a compatibility and security spike before production adoption.
- What are alternatives if this package is outdated or unsupported?
- Consider using the upstream SocialiteProviders/Providers monorepo directly, a maintained fork, or a custom Laravel Socialite provider. For OpenID Connect scenarios, evaluate a generic OIDC client instead. You can also pin this package and patch it through a Composer VCS override while tracking upstream fixes.