Socialite
Introduction
JCC Express MVC includes a Laravel-style Socialite package for OAuth login providers.
Entry point:
Socialite.driver("provider")
Supported drivers in current source:
googlegithubfacebookgitlabtwitterslack
Basic flow
Social login uses two route steps:
- redirect user to provider consent page
- handle callback and fetch normalized profile
Sign in with Auth.socialLogin(userId)
After you get the provider profile from Socialite.driver(...).user(), resolve or create your local app user, then call:
Auth.socialLogin(userId) delegates to auth token issuing and response handling, similar to regular login completion.
Scopes API
Use fluent scope helpers before redirect():
Or replace scopes fully:
Environment configuration
Each provider reads config from env keys:
{DRIVER}_CLIENT_ID{DRIVER}_CLIENT_SECRET- optional
{DRIVER}_REDIRECT_URI
Examples:
GOOGLE_CLIENT_ID,GOOGLE_CLIENT_SECRETGITHUB_CLIENT_ID,GITHUB_CLIENT_SECRET
Notes:
- if redirect URI is not set, Socialite builds one from
APP_URLand default callback paths - GitLab also supports
GITLAB_URLfor self-hosted instances
Session requirement
Socialite stores OAuth state (and PKCE verifier when needed) in jccSession.
That means your app must have session middleware enabled before calling:
Socialite.driver(...).redirect()Socialite.driver(...).user()
Returned user object
user() returns a SocialUser object with identity/profile fields (not provider OAuth tokens).
Methods:
getId()getEmail()getName()getAvatar()getRaw()toPlainObject()
Error behavior
OAuth failures throw SocialiteAuthError, for example:
- missing provider config
- missing/invalid authorization code
- invalid or expired OAuth state
- missing access token in provider response
