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 your_access_token
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​

Responses​

A successful response.

Response Headers