Third-Party Authorized Token Login
POST/auth/v1/signin/with/provider
API Description
Log in using a provider_token generated from third-party authorization information. Supports auto-registering new users or binding to existing users.
Input Requirements
client_id: Client ID corresponding to the application (optional, defaults to environment ID)x-device-id: Device ID (required, passed in the request header)- Request body parameters (
v1SignInWithProviderRequest):provider_token:provider_token(required, obtained via the Get Third-party Authorization Info API)force_disable_sign_up: Force disable auto registration (optional, defaultfalse)sync_profile: Whether to force synchronization of nickname and other information from the third party (optional, defaultfalse)
Prerequisites
- You must first call the Get Third-party Authorization Info API to obtain a valid
provider_token. - The
provider_tokenmust still be within its validity period (default 1 hour). - The third-party identity provider must be configured and enabled in the CloudBase console.
Output
- Returns a standard token response (
access_token,refresh_token, etc.). - If the user does not exist and auto registration is enabled, a new user will be created automatically.
- If the user already exists, the third-party identity provider will be bound to the existing user.
Request Example
POST /auth/v1/signin/with/provider
x-device-id: device_123456
Content-Type: application/json
{
"provider_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJwcm92aWRlciI6ImdpdGh1YiIsInN1YiI6IjEyMzQ1Njc4OTAiLCJleHAiOjE3MzQ2ODIzNTd9.bVJ0cE1xTnBWc0R5QmhKa0xmR3pYY1ZiTm1Bc1FkRmdIaktsTXBPclN0VXZXeElaQWJDZERlRmZHaEhpSmpLa0xs",
"force_disable_sign_up": false,
"sync_profile": true
}
Response Example
{
"token_type": "Bearer",
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2FwaS5leGFtcGxlLmNvbSIsInN1YiI6Ijk4NzY1NDMyMTAxMjM0NTY3ODkiLCJhdWQiOiJkZW1vLWFwcC0yZjhhOWMzZTFiNGQiLCJleHAiOjE3MzQ2NzU4ODksImlhdCI6MTczNDY2ODY4OSwic2NvcGUiOiJ1c2VyIn0.dGhpc19pc19hX2Zha2Vfc2lnbmF0dXJlX2Zvcl9leGFtcGxlX3B1cnBvc2VzX29ubHlfZG9fbm90X3VzZV9pbl9wcm9kdWN0aW9uX2Vudmlyb25tZW50X3RoaXNfaXNfbm90X3JlYWxfdG9rZW5fZGF0YQ",
"refresh_token": "m.aB3cD4eF5gH6iJ7kL8mN9oP0qR1sT2uV3wX4yZ5aB6cD7eF8gH9iJ0kL1mN2oP3qR4sT5uV6wX7yZ8",
"expires_in": 7200,
"scope": "user sso",
"sub": "9876543210123456789"
}
Key Characteristics
- Supports seamless login via third-party authorization information.
- Supports auto-registering new users.
- Supports binding the third-party identity provider to an existing account.
- Supports synchronizing basic information such as nickname and avatar from the third party.
Request
Query Parameters
client_id string
Client ID corresponding to the application, defaults to environment ID, can be omitted
Header Parameters
x-device-id stringrequired
Device ID
- application/json
Body
provider_id Identity source ID (string)required
provider_token Third-party providerToken obtained through /auth/v1/provider/token (string)required
force_disable_sign_up Force disable auto registration. By default, the server configuration prevails. If the client wants a smooth upgrade, it can be configured to true. (boolean)
sync_profile Whether to force synchronization of nickname and other information from third-party (boolean)
Responses
- 200
- 500
A successful response.
Response Headers
- application/json
- Schema
- Example (from schema)
Schema
token_type Access token type (string)
Uniformly return Bearer
access_token User's access token (string)
Token used to access Cloud Development HTTP API, length within 4096 bits
refresh_token User's refresh token (string)
access_token can be refreshed to get a new access_token when it expires through refresh_token, expiration time defaults to 31 days. Length within 128 bits
expires_in int32
Expiration time of access_token, in seconds
scope Authorization scope (string)
sub User's unique ID (string)
groups string[]
{
"token_type": "string",
"access_token": "string",
"refresh_token": "string",
"expires_in": 0,
"scope": "string",
"sub": "string",
"groups": [
"string"
]
}
An unexpected error response.
Response Headers
- application/json
- Schema
- Example (from schema)
Schema
error Error message (string)
error_code int32
error_description Error description (string)
{
"error": "string",
"error_code": 0,
"error_description": "string"
}
Loading...