Skip to main content

Unbind Third-Party Account

DELETE 

/auth/v1/user/provider/:provider_id

API Description

Unbind third-party account API, used to remove the binding relationship between the current logged-in user and specified third-party identity source (such as GitHub, WeChat, QQ, etc.).

Input Requirements

Required Parameters

  • provider_id: Identity source ID (required, path parameter, such as wx_open, github, wechat, etc.)
  • Authorization: Current logged-in user's access_token (required, passed in request header, format Bearer xxx)

Optional Parameters

  • with_user_center: Whether to record in user centralized security log (optional, boolean, default false)
  • client_id: Client ID (optional, defaults to environment ID)
  • x-device-id: Device ID (optional, passed in request header)

Prerequisites

Output Description

Successful Response

  • Returns empty object {}, indicating successful unbinding

Request Example

Unbind GitHub Account Request Example

DELETE /auth/v1/user/provider/github?with_user_center=true
Headers:
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2FwaS5leGFtcGxlLmNvbSIsInN1YiI6Ijk4NzY1NDMyMTAxMjM0NTY3ODkiLCJhdWQiOiJkZW1vLWFwcC0yZjhhOWMzZTFiNGQiLCJleHAiOjE3MzQ2NzU4ODksImlhdCI6MTczNDY2ODY4OSwic2NvcGUiOiJ1c2VyIn0.dGhpc19pc19hX2Zha2Vfc2lnbmF0dXJlX2Zvcl9leGFtcGxlX3B1cnBvc2VzX29ubHlfZG9fbm90X3VzZV9pbl9wcm9kdWN0aW9uX2Vudmlyb25tZW50X3RoaXNfaXNfbm90X3JlYWxfdG9rZW5fZGF0YQ
x-device-id: device_abc123

Unbinding Success Response Example

{}

Not Logged In Response Example

{
"error": "unauthorized",
"error_code": 4003,
"error_description": "User not logged in or access_token invalid"
}

Identity Source Not Found Response Example

{
"error": "provider_not_found",
"error_code": 4004,
"error_description": "Specified identity source does not exist"
}

Field Description

Request Parameters

Field NameTypeRequiredLocationDescription
provider_idstringYespathIdentity source ID, such as wx_open, github, wechat, qq, etc.
AuthorizationstringYesheaderCurrent logged-in user's access_token, format Bearer xxx
with_user_centerbooleanNoqueryWhether to record in user centralized security log, default false
client_idstringNoqueryClient ID, defaults to environment ID
x-device-idstringNoheaderDevice ID

Response Parameters

Field NameTypeRequiredDescription
-objectYesReturns empty object {} on success

Usage Flow

Complete Unbinding Flow

1. View Bound Identity Sources

2. Confirm Unbinding Operation

  • Prompt user to confirm unbinding operation
  • Explain impact after unbinding
  • Ensure at least one login method is retained

3. Execute Unbinding

  • Call this API
  • Pass provider_id to unbind
  • Pass valid access_token

4. Handle Result

  • Unbinding success: Update UI, remove the identity source
  • Unbinding failure: Display error message, prompt user

Notes

AccessToken

  • Must be valid access_token
  • Must be passed in request header
  • Format must be Bearer xxx
  • Need to re-login when token expires

Provider ID

  • Must be already bound identity source ID
  • Must be valid identity source
  • Can query through list API

Impact After Unbinding

  • Cannot login using this identity source anymore
  • Need to use other bound methods to login
  • Can re-bind anytime
  • Does not affect user's other data

Error Handling

Common Errors

  • unauthorized: User not logged in or access_token invalid
  • provider_not_found: Specified identity source does not exist
  • internal_error: Server internal error

Error Handling Strategy

  • Identity source not bound: Prompt user that identity source is not bound
  • Cannot unbind last one: Prompt user to keep at least one login method
  • Not logged in: Redirect to login page
  • Identity source does not exist: Prompt user to select valid identity source
  • Server error: Retry later or contact customer service

Request

Path Parameters

    provider_id stringrequired

    Identity source ID, such as wx_open, or WeChat Mini Program appid

Query Parameters

    client_id string

    Client ID corresponding to the application, can be obtained from Cloud Development Platform -> Identity Authentication -> Development Settings. Defaults to environment ID, can be omitted

    with_user_center boolean

    Whether to record in the user centralized security log

Header Parameters

    x-device-id string

    Device ID, the ID of the current logged-in device. The client should generate it randomly and cache it on the client. This parameter is related to the number of logged-in accounts.

    Authorization stringrequired

    The access_token of the current logged-in user, format is Bearer xxx

    Example: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2FwaS5leGFtcGxlLmNvbSIsInN1YiI6Ijk4NzY1NDMyMTAxMjM0NTY3ODkiLCJhdWQiOiJkZW1vLWFwcC0yZjhhOWMzZTFiNGQiLCJleHAiOjE3MzQ2NzU4ODksImlhdCI6MTczNDY2ODY4OSwic2NvcGUiOiJ1c2VyIn0.dGhpc19pc19hX2Zha2Vfc2lnbmF0dXJlX2Zvcl9leGFtcGxlX3B1cnBvc2VzX29ubHlfZG9fbm90X3VzZV9pbl9wcm9kdWN0aW9uX2Vudmlyb25tZW50X3RoaXNfaXNfbm90X3JlYWxfdG9rZW5fZGF0YQ

Body

    any

Responses

A successful response.

Response Headers
    Schema
      any
    Loading...