Skip to content

Commit

Permalink
⚡️ perf(oauth2): add details container for curl examples
Browse files Browse the repository at this point in the history
  • Loading branch information
SerinaNya committed Oct 1, 2024
1 parent dd40c10 commit c1e2efb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion docs/advanced/oauth2.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ outline: [2, 3]

<!--@include: ./for-experts.template.md-->

LittleSkin 支持 OAuth 2 服务端。你可以在你的应用中集成「使用 LittleSkin 账户登录」这样的功能。
LittleSkin 实现了 OAuth 2 服务端。你可以在你的应用中集成「使用 LittleSkin 账户登录」这样的功能。

## 参考文档

Expand Down Expand Up @@ -85,6 +85,8 @@ code = {{code}}
```

::: details curl 示例

```bash
curl -X POST \
--url "https://littleskin.cn/oauth/token" \
Expand All @@ -96,6 +98,8 @@ curl -X POST \
--data "code={{code}}"
```

:::

| 参数 ||
| --------------- | --------------------------- |
| `grant_type` | 固定值 `authorization_code` |
Expand Down Expand Up @@ -131,12 +135,16 @@ GET https://littleskin.cn/api/user HTTP/1.1
Authorization: Bearer {{access_token}}
```

::: details curl 示例

```bash
curl -X GET \
--url "https://littleskin.cn/api/user" \
--header "Authorization: Bearer {{access_token}}"
```

:::

如果一切在预料之中,这个请求会正确地返回用户的基本信息。

欲了解更多内容,请访问 [参考文档](#参考文档)[LittleSkin API](./api.md)
Expand All @@ -156,6 +164,8 @@ client_secret = {{client_secret}} &
scope = {{scope}}
```

::: details curl 示例

```bash
curl -X POST \
--url "https://littleskin.cn/oauth/token" \
Expand All @@ -167,6 +177,8 @@ curl -X POST \
--data "scope={{scope}}"
```

:::

| 参数 ||
| --------------- | ---------------------- |
| `grant_type` | 固定值 `refresh_token` |
Expand Down

0 comments on commit c1e2efb

Please sign in to comment.