feat(auth): add facebook identity psid login
This commit is contained in:
@@ -35,6 +35,9 @@ export class ApiPath {
|
||||
/** Facebook ID 登录(v7.0 新增) */
|
||||
static readonly facebookIdLogin = `${ApiPath._auth}/login/facebook/by-id`;
|
||||
|
||||
/** Facebook PSID 登录 */
|
||||
static readonly facebookPsidLogin = `${ApiPath._auth}/login/facebook/psid`;
|
||||
|
||||
/** 刷新 Token */
|
||||
static readonly refresh = `${ApiPath._auth}/refresh`;
|
||||
|
||||
@@ -51,6 +54,9 @@ export class ApiPath {
|
||||
/** 获取当前用户权益快照 */
|
||||
static readonly userEntitlements = `${ApiPath._user}/entitlements`;
|
||||
|
||||
/** 绑定 Facebook ASID / PSID */
|
||||
static readonly userFacebookIdentity = `${ApiPath._user}/facebook/identity`;
|
||||
|
||||
// ============ 支付相关 ============
|
||||
/** 创建充值订单 */
|
||||
static readonly paymentCreateOrder = `${ApiPath._payment}/create-order`;
|
||||
|
||||
@@ -10,7 +10,11 @@ import { httpClient } from "./http_client";
|
||||
import { ApiPath } from "./api_path";
|
||||
import { ApiEnvelope, unwrap } from "./response_helper";
|
||||
import {
|
||||
FacebookIdentityRequest,
|
||||
FacebookIdentityResponse,
|
||||
FacebookLoginRequest,
|
||||
FacebookPsidLoginRequest,
|
||||
FacebookPsidLoginResponse,
|
||||
FbIdLoginRequest,
|
||||
GoogleLoginRequest,
|
||||
GuestLoginRequest,
|
||||
@@ -82,6 +86,36 @@ export class AuthApi {
|
||||
return LoginResponse.fromJson(unwrap(env) as Record<string, unknown>);
|
||||
}
|
||||
|
||||
/**
|
||||
* Facebook PSID 登录
|
||||
*/
|
||||
async facebookPsidLogin(
|
||||
body: FacebookPsidLoginRequest,
|
||||
): Promise<FacebookPsidLoginResponse> {
|
||||
const env = await httpClient<ApiEnvelope<unknown>>(
|
||||
ApiPath.facebookPsidLogin,
|
||||
{ method: "POST", body: body.toJson() },
|
||||
);
|
||||
return FacebookPsidLoginResponse.fromJson(
|
||||
unwrap(env) as Record<string, unknown>,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定 Facebook ASID / PSID 到当前用户
|
||||
*/
|
||||
async bindFacebookIdentity(
|
||||
body: FacebookIdentityRequest,
|
||||
): Promise<FacebookIdentityResponse> {
|
||||
const env = await httpClient<ApiEnvelope<unknown>>(
|
||||
ApiPath.userFacebookIdentity,
|
||||
{ method: "POST", body: body.toJson() },
|
||||
);
|
||||
return FacebookIdentityResponse.fromJson(
|
||||
unwrap(env) as Record<string, unknown>,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出登录(fire-and-forget)
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user