BookStackApp/BookStack · warning · SocialSignInException
errors.social_login_bad_response
Error message
errors.social_login_bad_response
What it means
SocialSignInException thrown in SocialController::callback when the OAuth/social provider returned an 'error' and 'error_description' query parameter. The library surfaces the provider's own failure message, tagged with the driver name, and redirects the user back to /login.
Source
Thrown at app/Access/Controllers/SocialController.php:68
return $this->socialAuthService->startRegister($socialDriver);
}
/**
* The callback for social login services.
*
* @throws SocialSignInException
* @throws SocialDriverNotConfigured
* @throws UserRegistrationException
*/
public function callback(Request $request, string $socialDriver)
{
if (!session()->has('social-callback')) {
throw new SocialSignInException(trans('errors.social_no_action_defined'), '/login');
}
// Check request for error information
if ($request->has('error') && $request->has('error_description')) {
throw new SocialSignInException(trans('errors.social_login_bad_response', [
'socialAccount' => $socialDriver,
'error' => $request->input('error_description'),
]), '/login');
}
$action = session()->pull('social-callback');
// Attempt login or fall-back to register if allowed.
$socialUser = $this->socialAuthService->getSocialUser($socialDriver);
if ($action === 'login') {
try {
return $this->socialAuthService->handleLoginCallback($socialDriver, $socialUser);
} catch (SocialSignInAccountNotUsed $exception) {
if ($this->socialAuthService->drivers()->isAutoRegisterEnabled($socialDriver)) {
return $this->socialRegisterCallback($socialDriver, $socialUser);
}
throw $exception;View on GitHub (pinned to 18f8469a1c)
Solutions
- Read the included error_description for the provider's reason and fix the underlying provider-side issue
- Verify the callback/redirect URI registered with the provider exactly matches the app's generated callback URL
- Check client ID/secret configuration (service options and .env) are valid and current
- Re-run the login and grant consent when the error is user_access_denied
Defensive patterns
Strategy: try-catch
Validate before calling
if ($request->has('error') && $request->has('error_description')) {
\Log::warning('Social login error', ['driver' => $driver, 'desc' => $request->input('error_description')]);
} Try / catch
try {
$result = $socialController->callback($request, $driver);
} catch (\BookStack\Access\Exceptions\SocialSignInException $e) {
return redirect('/login')->with('error', $e->getMessage());
} Prevention
- Double-check the provider console redirect URI matches APP_URL exactly
- Rotate-test client credentials after any secret change
- Monitor error_description values for recurring consent/configuration issues
When it happens
Trigger: The identity provider redirects back to the callback URL with error parameters, e.g. user denied consent, invalid client_id/secret, misconfigured redirect URI, or provider-side account errors.
Common situations: User clicks 'Cancel'/'Deny' on the consent screen; redirect URI registered in the provider console does not exactly match APP_URL callback; provider app disabled or credentials rotated; scope changes rejected by the provider.
Related errors
- errors.social_no_action_defined
- errors.social_account_in_use
- errors.error_user_exists_different_creds
- errors.social_account_not_used
AI-assisted analysis of BookStackApp/BookStack@18f8469a1c (2026-09-02).
Data as JSON: /api/errors/6c847b4b9427ef5b.
Report an issue: GitHub.