passbolt/passbolt_api · error · BadRequestException

No valid SSO settings found.

Error message

No valid SSO settings found.

What it means

Catch-all in SsoOAuth2Service::assertAndGetSsoSettings: any exception while loading or validating active SSO settings (no active settings found, wrong provider, wrong data DTO) is wrapped and rethrown as BadRequestException 'No valid SSO settings found.' with the original exception chained as previous.

Solutions

  1. Ensure active (non-draft) SSO settings exist for OAuth2; complete the setup if not
  2. Point the SSO request at the endpoint matching the configured provider if it is not oauth2
  3. Check the previous exception in logs to distinguish not-found from provider/data mismatch
  4. Verify the app is connected to the environment/database that actually holds the SSO settings
Defensive patterns

Strategy: try-catch

Validate before calling

try {
    $settings = (new SsoSettingsGetService())->getActiveOrFail(true);
    $hasValidOauth2 = $settings->provider === SsoSetting::PROVIDER_OAUTH2
        && $settings->data instanceof SsoSettingsOAuth2DataDto;
} catch (RecordNotFoundException $e) {
    $hasValidOauth2 = false;
}

Try / catch

try {
    $settings = $oauth2Service->assertAndGetSsoSettings();
} catch (BadRequestException $e) {
    $previous = $e->getPrevious();
    // not-found => configure SSO; else provider/data validation issue
}

Prevention

When it happens

Trigger: SsoSettingsGetService->getActiveOrFail(true) throws because no active settings exist or none apply; or the provider/data validation errors above occur and are caught by this block.

Common situations: SSO not yet configured or settings deleted; settings exist only in draft state; request hit the OAuth2 endpoint while a different provider is active; environment/database mismatch (e.g. pointing at wrong database with no settings).

Understand the failure class

Background: "missing required config value" errors: why libraries refuse to start when a configuration key is empty, unset, or blank — this error's family across 48 libraries.

Related errors


AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17). Data as JSON: /api/errors/aa258465b5769fc6. Report an issue: GitHub.

Appendix: source

Thrown at plugins/PassboltEe/Sso/src/Service/Sso/OAuth2/SsoOAuth2Service.php:108

            ['httpClient' => $this->getCustomHttpClient()]
        );
    }

    /**
     * @return \Passbolt\Sso\Model\Dto\SsoSettingsDto
     */
    protected function assertAndGetSsoSettings(): SsoSettingsDto
    {
        try {
            $ssoSettings = (new SsoSettingsGetService())->getActiveOrFail(true);
            if ($ssoSettings->provider !== SsoSetting::PROVIDER_OAUTH2) {
                throw new BadRequestException('Invalid provider. Expected OAuth2.');
            }
            if (!($ssoSettings->data instanceof SsoSettingsOAuth2DataDto)) {
                throw new BadRequestException('Invalid provider data. Expected OAuth2 settings.');
            }
        } catch (Exception $exception) {
            throw new BadRequestException(__('No valid SSO settings found.'), 400, $exception);
        }

        return $ssoSettings;
    }
}

View on GitHub (pinned to 31c1bbc10f)