RocketChat/Rocket.Chat · error · Accounts.ConfigError
Service not configured
Error message
Service not configured
What it means
The Meteor login handler registered in oauth.js serves logins that pass { serviceName, accessToken, expiresIn } - the access-token login flow used by clients that already hold a provider token (mobile apps, deep links, API integrations). Before delegating to the registered AccessTokenService handler it verifies a ServiceConfiguration.configurations document exists for the serviceName; if not, it throws Accounts.ConfigError, whose rendered message is 'Service <name> not configured'. Note the neighbouring failures are distinct: an unknown serviceName throws 'Unexpected AccessToken service', an unregistered-but-configured service returns LoginCancelledError instead.
Source
Thrown at apps/meteor/server/lib/auth-providers/oauth/oauth.js:39
}
check(
options,
Match.ObjectIncluding({
serviceName: String,
}),
);
const service = AccessTokenServices[options.serviceName];
// Skip everything if there's no service set by the oauth middleware
if (!service) {
throw new Error(`Unexpected AccessToken service ${options.serviceName}`);
}
// Make sure we're configured
if (!(await ServiceConfiguration.configurations.findOneAsync({ service: options.serviceName }))) {
throw new Accounts.ConfigError();
}
if (!_.contains(Accounts.oauth.serviceNames(), service.serviceName)) {
// serviceName was not found in the registered services list.
// This could happen because the service never registered itself or
// unregisterService was called on it.
return {
type: 'oauth',
error: new Meteor.Error(Accounts.LoginCancelledError.numericError, `No registered oauth service found for: ${service.serviceName}`),
};
}
const oauthResult = await service.handleAccessTokenRequest(options);
return Accounts.updateOrCreateUserFromExternalService(service.serviceName, oauthResult.serviceData, oauthResult.options);
});
View on GitHub (pinned to b2c16d5842)
Solutions
- Save the custom OAuth service credentials in Admin -> OAuth so the ServiceConfiguration document exists
- Verify with db.ServiceConfiguration.configurations.findOne({ service: '<serviceName>' }) and re-create if missing
- Ensure the service is enabled and the serviceName sent by the client matches the admin entry exactly
- If you intended a different failure mode, distinguish it: unknown service name gives 'Unexpected AccessToken service', unregistered service gives LoginCancelledError
Example fix
// before: client sends { serviceName: 'my-idp', accessToken, expiresIn } with no config row
// -> Error: Service my-idp not configured
// after: admin saves My Idp credentials (writes ServiceConfiguration row), client retries the same call Defensive patterns
Strategy: try-catch
Validate before calling
// before attempting token login, verify the service is configured
import { ServiceConfiguration } from 'meteor/service-configuration';
const canLoginWithToken = async (serviceName: string): Promise<boolean> =>
!!(await ServiceConfiguration.configurations.findOneAsync({ service: serviceName }, { projection: { _id: 1 } }));
if (!(await canLoginWithToken('my-idp'))) throw new Error('SSO service not configured; ask admin to save credentials'); Try / catch
try {
const result = await Accounts.callLoginMethod({
methodArguments: [{ serviceName: 'my-idp', accessToken: token, expiresIn: 3600 }],
});
} catch (error) {
if (/not configured/i.test(error.message)) {
// config row missing: surface an admin-facing message instead of retrying
showError('SSO is not configured on this workspace.');
} else {
throw error;
}
} Prevention
- Seed/backup the ServiceConfiguration collection as part of deployment
- Validate serviceName on the client before attempting token login
- Distinguish this from 'Unexpected AccessToken service' (unregistered handler) when diagnosing
When it happens
Trigger: A client calls login/Meteor.loginWithService-style flow with options.accessToken for a custom OAuth service whose admin configuration was never saved or was deleted from ServiceConfiguration.configurations; service disabled in admin before the token login attempt.
Common situations: Mobile/app integrations using token login against a workspace where the OAuth app row is missing; environment restore without the ServiceConfiguration collection; service name typo that still matches a registered handler but has no config row.
Related errors
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/39e1b9b82b9dd710.
Report an issue: GitHub.