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 🙏

© 2025 – Pkg Stats / Ryan Hefner

spt-auth

v2.0.7-beta.1

Published

阿里体育前端授权组件

Downloads

5

Readme

spt-auth

https://yuque.antfin-inc.com/docs/share/b61f0ee9-9ab8-4f3c-b058-e2910fc3ac40?# 《授权使用文档》

阿里体育嵌入场C端应用前端授权库

可进行用户相关信息操作,用户授权登录,登录态管理

提供两种调用方式

  • npm
  • cdn

依赖

组件依赖 lib-login 和 lib-mtop,需要另外引入

<script src="https://g.alicdn.com/??mtb/lib-login/1.5.4/login.cmd.js,mtb/lib-mtop/2.3.5/mtop.cmd.js"></script>

如何使用

npm:

import auth from '@ali/spt-auth';
auth.doLogin(); //唤起登录组件
auth.doAuth('http://www.alisports.com/')
auth.getUserInfo()

cdn:

auth库依赖 spt-env,请确保已引入 env.js

<script src="https://g.alicdn.com/alisports-fe/lib-auth/2.0.0/index.js"></script>
<script>
  spt.auth.doAuth()
</script>

支持Promise(请确保你的浏览器支持Promise或使用Polyfill)

auth.doAuth().then((state) => {
  //state.login
  //state.tokens
  //state.tokens.sso
  //state.tokens.access
})
auth.getUserInfo().then((userinfo) => {
  //userinfo.nick
  //userinfo.avatar
});

Config

auth.config({
  appkey: 'alisp252627'
})

Demo

日常环境:http://wapp.waptest.taobao.com/phoenix/auth-test.html

APIs

  • isLogin: 根据当前应用渠道,探测账号是否登录 true | false
  • doLogin: 登录,返回Promise对象
  • doAuth: 授权阿里体育,返回Promise对象,成功则返回 sso_token 和 access_token,失败返回失败code
  • getSSOToken: 获取sso_token
  • renewSSOToken: 刷新ss_token
  • getUserInfo: 获取用户信息
  • getUserAliuid: 获取用户aliuid

其他APIs

  • isTaobaoLogin: 是否登录淘宝
  • isAlipayLogin: 是否登录支付宝
  • doTaobaoAuth: 淘宝渠道内授权阿里体育,一般不建议调用,建议使用封装好的 doAuth 方法
  • doAlipayAuth: 支付宝渠道内授权阿里体育,一般不建议调用,建议使用封装好的 doAuth 方法

SSOToken

SSOToken 有效期为6600-7200秒 前12为随机字符串,后10位为生成时的时间戳。 但是由于刷新token的存在,因此即使时间戳在有效期内,也不能认定其为有效的token。 由于续期逻辑的存在,因此也不能认为时间戳不在有效期的就是无效的token。

AccessToken