{"record":{"id":"aa258465b5769fc6","repo":"passbolt/passbolt_api","slug":"no-valid-sso-settings-found-ssooauth2service","errorCode":null,"errorMessage":"No valid SSO settings found.","messagePattern":"No valid SSO settings found\\.","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"plugins/PassboltEe/Sso/src/Service/Sso/OAuth2/SsoOAuth2Service.php","lineNumber":108,"sourceCode":"            ['httpClient' => $this->getCustomHttpClient()]\n        );\n    }\n\n    /**\n     * @return \\Passbolt\\Sso\\Model\\Dto\\SsoSettingsDto\n     */\n    protected function assertAndGetSsoSettings(): SsoSettingsDto\n    {\n        try {\n            $ssoSettings = (new SsoSettingsGetService())->getActiveOrFail(true);\n            if ($ssoSettings->provider !== SsoSetting::PROVIDER_OAUTH2) {\n                throw new BadRequestException('Invalid provider. Expected OAuth2.');\n            }\n            if (!($ssoSettings->data instanceof SsoSettingsOAuth2DataDto)) {\n                throw new BadRequestException('Invalid provider data. Expected OAuth2 settings.');\n            }\n        } catch (Exception $exception) {\n            throw new BadRequestException(__('No valid SSO settings found.'), 400, $exception);\n        }\n\n        return $ssoSettings;\n    }\n}\n","sourceCodeStart":90,"sourceCodeEnd":114,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/Sso/src/Service/Sso/OAuth2/SsoOAuth2Service.php#L90-L114","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Ensure active (non-draft) SSO settings exist for OAuth2; complete the setup if not","Point the SSO request at the endpoint matching the configured provider if it is not oauth2","Check the previous exception in logs to distinguish not-found from provider/data mismatch","Verify the app is connected to the environment/database that actually holds the SSO settings"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"try {\n    $settings = (new SsoSettingsGetService())->getActiveOrFail(true);\n    $hasValidOauth2 = $settings->provider === SsoSetting::PROVIDER_OAUTH2\n        && $settings->data instanceof SsoSettingsOAuth2DataDto;\n} catch (RecordNotFoundException $e) {\n    $hasValidOauth2 = false;\n}","typeGuard":null,"tryCatchPattern":"try {\n    $settings = $oauth2Service->assertAndGetSsoSettings();\n} catch (BadRequestException $e) {\n    $previous = $e->getPrevious();\n    // not-found => configure SSO; else provider/data validation issue\n}","preventionTips":["Complete SSO setup so an active (non-draft) configuration exists before login attempts","Use the chained previous exception to diagnose root cause","Ensure the app connects to the database containing the SSO settings"],"tags":["sso","oauth2","missing-settings","configuration"],"backgroundTag":"missing-config-value","analyzedSha":"31c1bbc10f32808a607fa9bd81891e898779c0bc","analyzedAt":"2026-09-17T00:04:38.960Z","contentChangedAt":"2026-09-17T00:04:38.960Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}