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

dd-sso

v1.0.0

Published

最好用的钉钉免登签名js库

Downloads

1

Readme

dd-auth-login

By Leo npm GitHub file size in bytes GitHub last commit GitHub package.json version Hex.pm

最好用的钉钉免登签名js库

:open_file_folder: 目录介绍

.
├── dist 编译产出代码
├── src 源代码目录
└── demo.html 示例文件

:rocket: 快速开始

1. 引入钉钉JSAPI

1.1如果你是浏览器环境

<script src="https://g.alicdn.com/dingding/dingtalk-jsapi/2.7.13/dingtalk.open.js"></script>

1.2如果你是webpack等环境

npm install dingtalk-jsapi --save
import * as dd from 'dingtalk-jsapi'; // 此方式为整体加载,也可按需进行加载

2. 引入本库

2.1如果你是浏览器环境

<script src="./dist/dd-auth-login.min.js"></script>

2.2如果你是webpack等环境

npm install dd-auth-login --save

或者

yarn add dd-auth-login

然后

import ddAuthLogin from 'dd-auth-login'

2.3如果你是requirejs环境

requirejs(['./dist/dd-auth-login.min.js'], function (res) {
    // xxx
})

3. 调用 login 函数进行签名&免登

ddAuthLogin.login({
  success: function(res) {
    console.log('免登成功啦啦啦', res)
  },
  fail: function(err) {
    console.log('啊哦,免登失败', err)
  }
})

:bookmark_tabs: AIP文档

ddAuthLogin.isDD()

返回当前是否钉钉环境; true: 是, false: 否

ddAuthLogin.login()

签名&免登过程

传入参数

| 参数名 | 类型 | 必填 | 默认值 | 说明 | | ----- | --- | ---- | ----- | --- | | debug | boolean | 否 | false | 是否开启 debug 模式 | | dd | object | 否 | null | 钉钉的JS SDK,由于require JS使用的问题,dd 变量没有暴露到全局,需要传入此参数 | | signUrl | string | 否 | '/data/labc-biz-dingding/dingTalk/getAuthInfo' | 请求签名地址 | | signParamName | string | 否 | 'url' | 请求签名参数名称 | | ssoUrl | string | 否 | '/data/labc-biz-dingding/dingTalk/sso' | 请求sso地址 | | ssoParamName | string | 否 | 'authCode' | 请求sso参数名称 | | jsApiList | array | 否 | 所有钉钉 API | 要签名的功能列表 | | success | function | 否 | 空 | 成功回调 | | fail | function | 否 | 空 | 失败回调 |

返回参数

| 参数名 | 类型 | 说明 | | ----- | --- | --- | | isDD | boolean | 当前是否钉钉环境 | | isLogin | boolean | 当前是否免登成功 | | msg | string | 对本次返回进行文字描述 | | content | object | 失败时的详细信息(仅在失败时返回) | | | | |

:loudspeaker: 接口说明(给后端同学看)

signUrl接口

请求类型: GET 传入参数: url = 'xxxxx(当前页面url)' 返回数据:

{
  content: {
    agentId: '微应用ID',
    corpId: '企业ID',
    timeStamp: '生成签名的时间戳',
    nonceStr: '生成签名的随机串',
    signature: '签名',
    hasLogin: '如果已经登录,则返回true,此时不会调用sso'
  },
  message: '接口调用成功',
  code: 200
}

ssoUrl接口

请求类型: GET 传入参数: authCode = 'xxxx(从dd.runtime.permission.requestAuthCode得到的code)' 返回数据如下:

{
  content: {},
  message: '接口调用成功',
  code: 200
}

:couple: 谁在使用

:see_no_evil: 相关链接