npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aliyun_numberauth_customization_web

v9.1.7

Published

![](https://intranetproxy.alipay.com/skylark/lark/__puml/de3375410b9f7ba14a56892ecff1c70e.svg#lake_card_v2=eyJ0eXBlIjoicHVtbCIsImNvZGUiOiJAc3RhcnR1bWxcbmFjdG9yIOeUqOaIt1xucGFydGljaXBhbnQgaDXlrqLmiLfnq69cbnBhcnRpY2lwYW50IOWPt-eggeiupOivgUpTU0RrXG5wYXJ0aWNp

Downloads

23

Readme

流程

下载安装

npm install aliyun_numberauth_customization_web

接口

初始化实例

var phoneServer = new PhoneServerCustomization();

网络类型检查接口(非必要接口)

接口名

  • getConnection

网络类型检查接口,客户可自行选择是否调用,对认证流程无阻碍。

调用示例

var netType =  phoneServer.getConnection();
// console.log(netType);
// netType 的值为 wifi cellular(流量) unknown(未知)

注: 此接口会判断当前用户的网络类型: wifi,cellular(流量),unknown(未知) 。 由于技术手段限制,前端无法准确的获取当前用户的网络类型,未使用流量的用户也无法通过一键登录完成认证。 提前获取到用户的网络类型,拦截掉使用WiFi网络的用户可以及时终止认证流程,节约资源,提升用户的认证体验。所以我们建议,认证前调用此接口,对netType为WiFi的用户及时提醒关闭WiFi或者提供其他认证方式,对于netType为unknown和cellular的用户继续一键登录流程。

一键登录

鉴权接口

接口名

  • checkLoginAvailable
调用示例
phoneServer.checkLoginAvailable({
        accessToken: 'xxxxxxx', // accessToken 服务端接口GetAuthToken返回
        jwtToken: 'xxxxxxxxx', // jwtToken  服务端接口GetAuthToken返回
        timeout: 2,
        callback: (res) => {
          if (res.code === 600000) {
            // 成功 调用获取掩码接口
            return;
          }

          // 失败 
       }
});

获取掩码接口

  • getLoginMaskPhone tips: checkLoginAvailable成功(code为600000)调用此接口
调用示例
phoneServer.getLoginMaskPhone({
        timeout: 3, // 超时逻辑 从调用getLoginToken到获取到掩码的超时时间
        callback: (res) => {
          window.console.log(res);
          if (res.code === 600000) {
            // 成功 弹出授权页弹窗
            return;
          }

          // 失败
        }
      });

获取token接口

  • getLoginToken
调用示例
phoneServer.getLoginToken({
        mask: '1234', // 用户输入的中间4位掩码
        timeout: 2, // 超时逻辑 从调用getLoginToken到获取到掩码的超时时间
        callback: (res) => {
          window.console.log(res);
          if (res.code === 600000) {
            // 成功 调用服务端接口 GetPhoneWithToken
            return;
          }

          // 失败 
        }
      });

本机号码校验

鉴权接口

接口名

  • checkAuthAvailable
调用示例
phoneServer.checkAuthAvailable({
        accessToken: 'xxxxxxx', // accessToken 服务端接口GetAuthToken返回
        jwtToken: 'xxxxxxxxx', // jwtToken  服务端接口GetAuthToken返回
        timeout: 2,     // 默认2(秒)
        callback: (res) => {
          if (res.code === 600000) {
            // 成功 调用获取token接口
            return;
          }

          // 失败 
       }
});

获取token接口

  • getVerifyToken
调用示例
phoneServer.getVerifyToken({
        timeout: 3, // 超时逻辑 从调用getLoginToken到获取到掩码的超时时间 默认3(秒)
        callback: (res) => {
          window.console.log(res);
          if (res.code === 600000) {
            // 成功 调用服务端接口 VerifyPhoneWithToken
            return;
          }

          // 失败 
        }
      });

运营商协议

中国移动认证服务条款:https://wap.cmpassport.com/resources/html/contract.html 中国联通认证服务条款:https://hs.wosms.cn/protocol/protocol.html 中国电信天翼账号服务条款: https://e.189.cn/sdk/agreement/detail.do?hidetop=true

错误码

| 返回码 | web | | --- | --- | | 600000 | 成功的返回code | | 600004 | 方案号不存在 | | 600010 | 未知异常 | | 600015 | 接口超时 | | 600011 | 获取token失败 | | 600025 | 接入方身份信息校验失败 | | 600028 | 入参错误 | | 600012 | 获取掩码失败 | | 600013 | 调取获取掩码接口时需先鉴权成功 | | 600014 | 未查询到掩码,请先调用getLoginMaskPhone接口获取掩码 |