Custom Login
POST/auth/v1/signin/custom
Applicable Scenarios
- One-to-one mapping between enterprise's own account system and CloudBase account system
- Business scenarios that require completely customized authentication processes
- Need to achieve seamless integration between your own account system and CloudBase services
Function Description
1. Server-side Issued Ticket
Developers need to use the CloudBase SDK on the server side to issue login credentials (Ticket), which are used for subsequent client authentication.
- Refer to Custom Login Documentation for the part before obtaining the ticket.
Code Example:
const cloudbase = require("@cloudbase/node-sdk");
// 1. Initialize SDK
const app = cloudbase.init({
env: "your-env-id",
// Pass custom login private key
credentials: require("/path/to/your/tcb_custom_login.json")
});
// 2. Developer-defined unique user identifier
const customUserId = "your-customUserId";
// 3. Create ticket
const ticket = app.auth().createTicket(customUserId);
// 4. Return ticket to client
return ticket;
2. Client-side Custom Login
API Description
The client uses the server-issued Ticket to obtain access credentials.
Request Example:
{
"provider_id": "custom",
"ticket": "your_ticket"
}
Key Features:
- access_token is valid for 7200 seconds (2 hours)
- refresh_token is valid for 2592000 seconds (30 days)
- It is recommended to implement an automatic token refresh mechanism
Request
Responses
- 200