gj-sso-sdk
v3.3.12
Published
钉钉应用统一登录jssdk
Downloads
2,584
Maintainers
Readme
gj-sso-sdk
统一单点登录业务 通用 jssdk
📱已接入业务
PC端系统
- BPM管理后台
- BPM用户端
- SRM管理平台
- SRM商城
- WMS兰州
- WMS贵州
- CRM管理后台
- MES熟食系统
- 薪酬系统
- 日报系统
- 价盘系统
- 开发管理系统
- 任免公告系统
- 工单系统
- 禅道项目管理
移动端
- CRM移动端
- 日报移动端
- 数据中台移动报表
📅 版本历史
3.3.11 2023/01/05
- 【更新】PC端扫码登录支持指定回调页面
3.3.10 2022/07/28
- 【更新】移除session标识控制登录确认安全机制
- 【更新】用户token存储cookie有效期更改为session级别
3.3.8 2022/07/22
- 【更新】移动端免密登录增加缓存策略及token刷新机制,移除强制登录,移除登录时强制dd.config的步骤
3.2.0 2022/05/31
- 【新增】免密登录新增工作台渠道标识,避免与移动端互斥
3.1.0 2022/03/30
- 【新增】新增pre环境配置,支持pre环境登录及token读写
3.0.8 2021/12/31
- 【修复】修复SSOLoginConfig类型声明异常的bug
3.0.0 2021/10/10
- 【更新】更新业务中台认证中心接口
- 【更新】支持v2和v3两个版本兼容
- 【新增】支持租户tenantId
2.1.7-userInfo 2021/09/14
- 【新增】增加用户信息缓存本地
2.1.0-sync-runtime 2021/08/10
- 【更新】拆分和优化钉钉免密登录逻辑
- 【更新】所有api调用支持promise调用,config函数从异步变更为同步调用
2.0.11-stable 2021/07/22
- 【更新】优化runtime.permission时序问题
2.0.0 2021/07/09
- 【更新】接入中台登录重构
- 【新增】新增单点登出功能
1.2.25 2021/06/28
- 【新增】支持其他系统session级别的登录保持
- 【新增】增加钉钉调用api封装
1.1.0 2021/04/21
- 【更新】更换sdk命名空间
- 【新增】支持local环境匹配dev环境token信息
1.0.8 2021/04/20
- 【新增】增加中台登出功能
1.0.0 2021/04/13
- 【新增】支持钉钉(桌面/移动端)应用内免密登录
- 【新增】支持非钉钉微应用内打开接入中台单点登录
🧩 基础核心依赖
- TypeScript
- axios
🧩 功能模块
- 钉钉运行端环境映射
- 离线化透传登录信息
🎉 使用
🛎️ 安装
yarn add gj-sso-sdk -D
or
npm i -D gj-sso-sdk
🧭 调用
页面内 head 中引入 dd-jssdk
查阅文档:https://zentao.gaojin.com.cn/zentao/doc-objectLibs-product-22-247-231.html#app=doc
在项目的入口文件调用
import SsoSDK from 'gj-sso-sdk'
...
await SsoSDK.config({
env: 'dev', // 环境
jsApiList: [] // 钉钉内打开时,需要鉴权的jsApiList,只对于钉钉微应用生效,非钉钉内打开应用可传 空数组
})
☘️ 目录结构
├── LICENSE
├── README.md
├── babel.config.js
├── docs-source
│ ├── .DS_Store
│ ├── docs
│ │ ├── .DS_Store
│ │ ├── .vuepress
│ │ ├── README.md
│ │ ├── core
│ │ ├── enhance
│ │ └── guide
│ ├── package.json
│ └── yarn.lock
├── examples
│ └── index.html
├── jsdoc.json
├── package.json
├── rollup.config.js
├── src
│ ├── declare
│ │ ├── define.ts
│ │ └── profile.ts
│ ├── http
│ │ ├── HttpClient.ts
│ │ └── Service.ts
│ ├── index.ts
│ └── utils
│ ├── Cookie.ts
│ └── DB.ts
├── tsconfig.json
├── yarn-error.log
└── yarn.lock
🧭 指令
yarn tree
显示目录树yarn install
安装依赖yarn build
构建 npm 包yarn docs:dev
文档服务本地启动yarn docs:build
编译文档服务项目
🛎️ 编译环境变量参数说明
- BUILD_ENV 数据库连接环境,接口域名
- local: 本地开发,相对路径,会走 node 的转发代理
- dev: dev 域名
- test: test 域名
- uat: uat 域名
- prod: prod 域名
rollup 插件配置
- rollup-plugin-typescript2
- rollup-plugin-typescript 无法完成 ts 声明文件的导出,替换为 typescript2 插件
🎉 其他
关于钉钉鉴权
- 调用后端 ddConfig 接口时传入的 url,必须与当前页面的 url 一致即可,不需要与后台配置的应用首页地址一致。