跳到主要内容

帐号功能

更新时间:2025-08-20 15:22:48

帐号功能包括:用户登录、登出等功能。开发可先阅读用户账号开发指南

接口与类型定义详见sdk中dist目录下index.d.ts文件


/**
* 自建帐号OAuth2协议登录
* @param token - 自建帐号用户token
* @returns
* @public
*/
declare function loginByAuth2(authCode: string): Promise<IUserLoginResp>;

/**
* 帐号密码登录
* @param account - 帐号
* @param password - 密码
* @public
*/
declare function loginByPassword(account: string, password: string): Promise<IUserLoginResp>;


/**
* 退出登录
* @public
*/
declare function logout(): Promise<void>;


export declare namespace RTCXAccount {
export {
loginByPassword,
loginByAuth2,
logout
}
}

内置帐号

用户登录

import {
RTCXAccount,
} from '@rtcx/websdk'
const account = '帐号'
const password = '密码'
RTCXAccount.loginByPassword(account, password)

用户登出

import {
RTCXAccount,
} from '@rtcx/websdk'
RTCXAccount.logout()

自有帐号体系

用户登录

import {
RTCXAccount,
} from '@rtcx/websdk'
const authCode = '授权code'
RTCXAccount.loginByAuth2(authCode)