# OA第三方登录

使用本接口可以将本站的用户信息接入您的应用中，实现数据共享。

[点击这里](https://open.wjlnb.com/oalogin/reg) 申请该项目的appid

[点击这里](https://demo.wjlnb.com/open/oa/) 体验该项目的demo

登录发起URL：

```
https://open.wjlnb.com/oalogin/1.0/auth
```

应有参数：

| 参数    | 说明          |
| ----- | ----------- |
| appid | 开放平台应用appid |

示例URL：

```
https://open.wjlnb.com/oalogin/1.0/auth?appid=demo
```

在显示页面中可进行登录操作，认证通过后将携带 oacode 被重定向至回调地址

正常回调的话，回调地址url内应如下图所示

其中，code后就是oacode，是您向服务器发起验证的凭证

```
http://callbackurl?code=6d5a8408-0ee3-7337-9df1-f80699c45547
```

回调地址在获取到oacode后应与服务器验证

请求URL

```
https://open.wjlnb.com/oalogin/1.0/get
```

请求参数：

| 参数        | 说明              |
| --------- | --------------- |
| appid     | 开放平台应用appid     |
| appsecret | 开放平台应用appsecret |
| code      | 系统给予回调地址的oacode |

验证通过后将会返回json格式的信息

基本登录回调内容：

| 参数     | 说明     |
| ------ | ------ |
| status | 提示请求状态 |
| oaname | 用户名    |
| oaavr  | 用户头像地址 |
| oaid   | 用户uid  |

{

"status":"ok",

"oaname":"adminwjl",

"oaavr":"https:\\/\\/avatar.wjlcdn.com\\/u\\/1\\/a1626766507.jpeg",

"oaid":"1"

}

**常见错误代码：**

| 环节   | **所属参数** | 错误提示               | 说明                |
| ---- | -------- | ------------------ | ----------------- |
| 发起登录 | -        | 弹出窗口：该应用不存在        | 找不到匹配的appid       |
| 回调   | status   | error:timeout      | oacode过期了，应重新发起登录 |
| 回调   | status   | error:codenotfound | 数据库中找不到匹配的oacode  |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wjlo.cc/open/openoalogin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
