bind_auth_service

To connect or disconnect an authentication service, use the user/bind_auth_service method.

Copied!
svc=user/bind_auth_service&params={
  "service": "<text>",
  "token": "<text>",
  "mode": <bool>,
  "serviceId": "<text>",
  "userId": <long>
}

Parameters

The required parameters are marked with an asterisk (*).

Parameter Description
service* Authentication service name, for example, google. The service must be supported on the server.
token* Authentication service access token.
mode* 1 to connect, 0 to disconnect.
serviceId* User ID from the authentication service. It must match the ID returned by the authentication service for the specified token.
userId ID of the user for whom the authentication service is connected or disconnected. If the parameter isn’t specified, the current user is used. To connect or disconnect the service for another user, you need the Act on behalf of this user access right to this user.

Response

If the request is completed successfully, the response is returned in the following format:

Copied!
{
  "<text>": "<text>"  /* Service name: user email from the authentication service, for example, "google":"john.doe@gmail.com". When disconnecting, the value is empty. */
}

If the request fails, an error code is returned.

Error codes

Error code Description
4 One of the following errors:
  • Wrong input parameters.
  • The authentication service isn’t supported on the server.
  • The current user isn’t found.
  • The serviceId value doesn’t match the ID returned by the authentication service.
  • When disconnecting, the authentication service isn’t connected to the specified user.
6 The request isn’t supported on the server, or failed to verify the token with the authentication service, or failed to connect or disconnect the authentication service.
7 The user isn’t found, or you have no Act on behalf of this user access right to this user.
1002 The authentication service account is already connected to a user.

If you find a mistake in the text, please select it and press Ctrl+Enter.