## 1、为企业绑定域名
![](https://box.kancloud.cn/70eaf402e8d21dcf655d53ade0040e66_1339x430.png)
> 比如企业绑定的域名的是 `bind.com`
>
## 2、设置单点登录接口
![](https://box.kancloud.cn/9f53a91bd223870b06f451a65bccee54_1189x473.png)
> 比如单点登录接口设置的是 `http://www.example.com/auth`
阅读私有文档或者编辑文档时,会自动跳转到你设置的单点登录接口的地址上获取授权 ,并且带上当前访问的时间,访问的地址,访问的文档标识
如
~~~
http://www.example.com/auth?time=123456&book=qiye/wendang&return_url=http://bind.com/wendang/edit
~~~
授权后需要跳转到你绑定的企业域名上,并且带上以下参数:
|参数名|参数说明|
|---|---|
|book | 请求授权时的,原样带回|
|name| 用户昵称|
|username| 用户名,企业内唯一|
|email| 邮箱|
|authorize| 权限 pull push admin 阅读,写作,管理 使用逗号隔开|
|time| 当前时间戳|
|token |md5(以上参数按照上面的顺序拼起来+企业的api token)|
|return_to |请求授权时的,原样带回|
如
~~~
http://bind.com/sso?book=qiye/wendang&username=yunwuxin&email=448901948@qq.com&name=yunwuxin&authorize=push,pull,admin&time=1510131589&token=4ca7ea24452796de46b416e7ba7a7775&return_to=http//bind.com/wendang/edit
~~~
上面`token`生成的代码为
~~~
md5("qiye/wendangyunwuxinyunwuxin448901948@qq.compush,pull,admin1510131589[api token]")
~~~
## 3、通过绑定的企业域名编辑文档
1、直接企业下的文档
~~~
http://bind.com/bookname/edit
~~~
2、企业团队下的文档
~~~
http://bind.com/@teamname/bookname/edit
~~~