如何引入OIDC服务(1)

如下为使用默认风格的代码示例:

a、引入样式:

<link rel="stylesheet" href="http://oidc.org.cn/app/oidc.css" />

b、引入数据;

<script type="text/javascript" src="http://oidc.org.cn/oauth/osp.js?key=YOUR_APP_KEY" charset="utf-8"></script>

c、引入脚本:

<script type="text/javascript" src="http://oidc.org.cn/app/oidc.js" charset="utf-8"></script>

e、添加容器标签:

<div id="oidc" name="oidc"></div>

d、初始化调用:

<script type="text/javascript">
    // 使用默认参数
	oidc.init("YOUR_APP_KEY", "oidc");
	
	// 使用自定义参数
	var option = {};
	oidc.init("YOUR_APP_KEY", "oidc", option);
</script>

e、option选项说明

属性类型说明
logBoolean是否输出Log,默认否。
modeString应用模式,可选有web(默认),spa(单页应用)
viewString界面展示方式,可选有list(列表展示,默认),none(不展示)
styleString显示视图,可选有list(默认),card(卡片),icon(图标),item(选项)
targetString链接打开方式,可选有none(默认),tab,window,dialog
httpsBoolean是否启用Https协议,默认不启用
showCardBoolean是否显示卡片
showHeadBoolean是否显示卡片头部信息
headHtmlString卡片头部自定义内容(HTML格式)
showFootBoolean是否显示卡片尾部信息
footHtmlString卡片尾部自定义内容(HTML格式)
alignString图标(icon)视图时,对齐方式,start(默认),center,end
columnsNumber卡片(card)视图时,显示的列数,默认1
response_typeString响应方式
redirect_uriString回调地址
stateString回调参数
scopeString授权范围