1.1.11 • Published 3 years ago

@doctorwork/sso-sdk v1.1.11

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

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.

1.1.11

3 years ago

1.1.10

3 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.0.6

4 years ago