passbolt/passbolt_api · error · BadRequestException

Service provider missing.

Error message

Service provider missing.

What it means

Thrown by SsoSettingsSetService::getSsoSettingsForm when the request payload has no 'provider' key. The service needs the provider name to select the matching settings validation form, so a missing provider is a bad request rejected before any validation runs.

Solutions

  1. Add "provider": "azure" (or google/adfs/oauth2/pingone) to the request body.
  2. Check the official API docs/swagger for the correct payload shape for your passbolt version.
  3. Capture the exact request body in the client and diff against a known-good example.

Example fix

// before
{ "data": { "url": "...", "client_id": "..." } }
// after
{ "provider": "azure", "data": { "url": "...", "client_id": "..." } }
Defensive patterns

Strategy: validation

Validate before calling

if (empty($payload['provider']) || !is_string($payload['provider'])) { throw new \InvalidArgumentException('provider is required'); }

Try / catch

try { $res = $api->setSsoSettings($payload); } catch (BadRequestException $e) { if ($e->getMessage() === 'Service provider missing.') { /* fix payload */ } throw $e; }

Prevention

When it happens

Trigger: POST/PUT /sso/settings with a payload lacking the top-level 'provider' field (e.g. sending only the settings data object, or nesting provider inside data instead of alongside it).

Common situations: Client integrations sending the wrong payload shape; curl/scripts omitting the provider field; API changes between passbolt versions where payload structure moved.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsSetService.php:151

                $gpg->setEncryptKeyFromFingerprint($fingerprint);
            } catch (Exception $exception) {
                $msg = __('The OpenPGP server key defined in the config cannot be used to encrypt.') . ' ';
                $msg .= $exception->getMessage();
                throw new InternalErrorException($msg, 500, $exception);
            }
        }

        return $gpg->encrypt($jsonData, true);
    }

    /**
     * @param array $data payload
     * @return \Passbolt\Sso\Form\BaseSsoSettingsForm
     */
    protected function getSsoSettingsForm(array $data): BaseSsoSettingsForm
    {
        if (!isset($data['provider'])) {
            throw new BadRequestException('Service provider missing.');
        }
        if (!is_string($data['provider'])) {
            throw new BadRequestException('Service provider invalid.');
        }
        if (!in_array($data['provider'], SsoSetting::ALLOWED_PROVIDERS)) {
            throw new BadRequestException('Service provider not supported.');
        }

        switch ($data['provider']) {
            case SsoSetting::PROVIDER_AZURE:
                return new SsoSettingsAzureDataForm();
            case SsoSetting::PROVIDER_GOOGLE:
                return new SsoSettingsGoogleDataForm();
            case SsoSetting::PROVIDER_OAUTH2:
                return new SsoSettingsOAuth2DataForm();
            case SsoSetting::PROVIDER_ADFS:
                return new SsoSettingsAdfsDataForm();
            case SsoSetting::PROVIDER_PINGONE:

View on GitHub (pinned to 31c1bbc10f)