{"record":{"id":"b7d22a148866fde7","repo":"passbolt/passbolt_api","slug":"invalid-provider-data-expected-google-settings","errorCode":null,"errorMessage":"Invalid provider data. Expected Google settings.","messagePattern":"Invalid provider data\\. Expected Google settings\\.","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"plugins/PassboltEe/Sso/src/Service/Sso/Google/SsoGoogleService.php","lineNumber":88,"sourceCode":"        return SsoProviderFactory::create(GoogleProvider::class, [\n            'clientId' => $data->client_id,\n            'clientSecret' => $data->client_secret,\n            'redirectUri' => Router::url('/sso/google/redirect', true),\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_GOOGLE) {\n                throw new BadRequestException('Invalid provider. Expected Google as provider.');\n            }\n            if (!($ssoSettings->data instanceof SsoSettingsGoogleDataDto)) {\n                throw new BadRequestException('Invalid provider data. Expected Google 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    // HELPERS\n}\n","sourceCodeStart":70,"sourceCodeEnd":99,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/Sso/src/Service/Sso/Google/SsoGoogleService.php#L70-L99","documentation":"Thrown by SsoGoogleService::assertAndGetSsoSettings when the active SSO settings' provider is Google but the settings `data` payload is not a SsoSettingsGoogleDataDto instance. The service requires Google-typed settings data to read the Google client id/secret etc.","triggerScenarios":"The sso_settings row has provider='google' but its serialized data deserializes into a different DTO (e.g. SsoSettingsAzureDataDto or a generic array), typically from a provider change where the data field was not rewritten, or from corrupted/partially-migrated settings data.","commonSituations":"Admin edited provider field directly in the database without updating the data payload; an import/restore from backup paired Google provider with another provider's data; a version upgrade changed the DTO mapping and legacy data no longer hydrates to SsoSettingsGoogleDataDto.","solutions":["Re-save the Google SSO settings through the SSO settings API/admin UI so the data payload is rebuilt as Google settings","Inspect the sso_settings table data column and confirm it contains Google-specific fields (client_id, client_secret, etc.)","Verify SsoSettingsGetService hydration/DTO factory maps provider 'google' to SsoSettingsGoogleDataDto, especially after upgrades","If migrating providers, always submit provider AND matching data together in one settings update"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"$settings = (new SsoSettingsGetService())->getActiveOrFail(true);\nif (!($settings->data instanceof SsoSettingsGoogleDataDto)) {\n    throw new BadRequestException(__('Google SSO settings data is invalid; re-save the settings.'));\n}","typeGuard":"if (!($ssoSettings->data instanceof SsoSettingsGoogleDataDto)) {\n    return null;\n}","tryCatchPattern":"try {\n    $settings = $googleService->assertAndGetSsoSettings();\n} catch (BadRequestException $e) {\n    // log $e->getPrevious(); prompt admin to re-save Google settings\n}","preventionTips":["Always update provider and data payload together in one settings save","Re-save settings after version upgrades that touch SSO DTOs","Never edit the sso_settings data column manually"],"tags":["sso","google","settings-data","type-mismatch"],"backgroundTag":"type-mismatch","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"}