🚀 DAY 3 OF LAUNCH WEEK: Introducing Webhook Events for Pull Request Scans.Learn more
Socket
Book a DemoInstallSign in
Socket

@doctorwork/sso-sdk

Package Overview
Dependencies
Maintainers
6
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@doctorwork/sso-sdk

--- title: sso-js-sdk ---

latest
npmnpm
Version
1.1.11
Version published
Maintainers
6
Created
Source

title: sso-js-sdk

sso-sdk

使用

nodejs 环境使用

npm install @doctorwork/sso-sdk

const sso = require("@doctorwork/sso-sdk")('dev');

直接使用

在 index.html中加入

<script src="https://cdn.doctorwork.com/sso/sdk.min.js?env=prod"></script>

如果使用 webpack-html-plugin

在 index.html中加入

new HtmlWebpackPlugin({
    template: './src/public/template.html',
    title: 'Custom template using html-loader',
    env: process.env.APP_ENV
})

<script src="https://cdn.doctorwork.com/sso/sdk.min.js?env=<%= htmlWebpackPlugin.options.env %>"></script>

UMI中使用

在 .umirc.js 中加入

// [env] 替换为对应环境变量

export default {
    scripts: [
        "https://cdn.doctorwork.com/sso/sdk.min.js?env=" + process.env.BuildEnv || 'dev'
    ],
}

在blade-script中使用

在 app.html 中加入

// web.config.js
{
    html: {
        env: process.env.APP_ENV
    }
}

<script src="https://cdn.doctorwork.com/sso/sdk.min.js?env=<%= htmlWebpackPlugin.options.env %>"></script>

在 vue/cli 和 create-react-app 项目中使用

在 index.html 中加入

process.env.APP_ENV=dev
// 可以直接使用 环境变量
<script src="https://cdn.doctorwork.com/sso/sdk.min.js?env=<%= APP_ENV %>"></script>

API

SDK,使用umd规范,默认会在window下注册全局变量 $sso

获取授权回调地址 - getRedirectUri

返回当前环境对应的注册回调地址,目前各环境注册地址如下

环境地址
devhttps://sphinx.xingrengo.com
qahttps://sphinx.aihaisi.com
prehttps://sphinx.xrxr.xyz
prodhttps://sphinx.xrxr.xy

返回值

http://oa.sso.developer.doctorwork.com/

License

MIT.

FAQs

Package last updated on 11 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts