1.2.1 • Published 4 years ago

edu-idaas-client v1.2.1

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

idaas-client

用于web场景对接public-account(原idaas)的客户端

Usage

安装依赖

npm i idaas-client

创建client对象

import {SimpleIDaaSClient} from "idaas-client";

const client = new SimpleIDaaSClient({
    appId: 1, //后台分配,帐号系统的appId
    captchaAid: 123456, //后台分配,需要前端验证码的场景填入验证码aid,无验证码场景不用填
    basePath: "/subpath", //整体系统basepath,一般不用填
    domain: "some.domain.com", //后台域名非当前域名的情况下需要填写
});

密码登录

try {
    const response = await client.passwordLogin({
        namespace: 1, //主帐号id,子帐号登录时需要填写
        captcha: { //验证码票据,业务自行处理验证码的时候需要填写
            ticket: "",
            randStr: "",
        },
        //用户名/邮箱/国家码手机号三选一
        username: "",
        email: "",
        nation: "",
        phone: ""
    }, password);
    if (response.code === 12050) {//需要重置密码后才能登录
        if (client.loginResetNeedOldPassword()) {//判断是否需要旧密码
            await client.loginResetPassword(oldPassword, newPassword)
            //重置成功
        } else {
            await client.loginSetPassword(newPassword)
            //设置新密码成功
        }
    } else if (response.code === 0) {
        //登录成功
    }
} catch (e) {
    if (e instanceof SimpleIDaaSClientException) {
        //其他错误
        alert(e.response.message)
    }
}

小程序

idaas-client-mp

1.2.1

4 years ago

1.2.0

4 years ago

1.1.32

4 years ago

1.1.31

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.0.1

4 years ago