Skip to content

Commit 3792a87

Browse files
committed
update douyin webapp oauth service
1 parent 9c875fc commit 3792a87

File tree

2 files changed

+114
-39
lines changed

2 files changed

+114
-39
lines changed

douyin-webapp/oauth.proto

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
// 抖音移动/网站应用接口 douyin-webapp
2+
3+
syntax = "proto3";
4+
package open.douyin.com ;
5+
import "google/api/annotations.proto";
6+
7+
option go_package = "github.com/dev-openapi/douyin-webapp";
8+
9+
service OauthService {
10+
/* 用户授权 */
11+
// 获取 access_token https://developer.open-douyin.com/docs/resource/zh-CN/dop/develop/openapi/account-permission/get-access-token
12+
rpc GetAccessToken(GetAccessTokenReq) returns (GetAccessTokenRes) {
13+
option (google.api.http) = {
14+
post: "/oauth/access_token",
15+
body: "*"
16+
};
17+
};
18+
// 刷新 refresh_token form格式 https://developer.open-douyin.com/docs/resource/zh-CN/dop/develop/openapi/account-permission/refresh-token
19+
rpc RenewRefreshToken(RenewRefreshTokenReq) returns (RenewRefreshTokenRes) {
20+
option (google.api.http) = {
21+
post: "/oauth/renew_refresh_token",
22+
body: "*,form"
23+
};
24+
};
25+
// 生成client_token https://developer.open-douyin.com/docs/resource/zh-CN/dop/develop/openapi/account-permission/client-token
26+
rpc GetClientToken(GetClientTokenReq) returns (GetClientTokenRes) {
27+
option (google.api.http) = {
28+
post: "/oauth/client_token",
29+
body: "*"
30+
};
31+
};
32+
// 刷新access_token https://developer.open-douyin.com/docs/resource/zh-CN/dop/develop/openapi/account-permission/refresh-access-token
33+
rpc RefreshAccessToken(RefreshAccessTokenReq) returns (RefreshAccessTokenRes) {
34+
option (google.api.http) = {
35+
post: "/oauth/refresh_token",
36+
body: "*,form"
37+
};
38+
}
39+
}
40+
41+
message GetAccessTokenReq {
42+
string client_secret = 1; // 应用唯一标识对应的密钥
43+
string code = 2; // 授权码
44+
string grant_type = 3; // 固定值"authorization_code"
45+
string client_key = 4; // 应用唯一标识
46+
}
47+
message GetAccessTokenRes {
48+
string message = 1;
49+
message Data {
50+
int64 error_code = 1;
51+
int64 expires_in = 2; // access_token接口调用凭证超时时间,单位(秒)
52+
string open_id = 3; // 授权用户唯一标识
53+
int64 refresh_expires_in = 4; // refresh_token凭证超时时间,单位(秒)
54+
string refresh_token = 5; // 用户刷新 access_token
55+
string scope = 6; // 用户授权的作用域(Scope),使用逗号(,)分隔,开放平台几乎每个接口都需要特定的Scope。
56+
string access_token = 7; // 接口调用凭证
57+
string description = 8; // 错误码描述
58+
}
59+
Data data = 2;
60+
}
61+
62+
message RenewRefreshTokenReq {
63+
string client_key = 1;
64+
string refresh_token = 2;
65+
}
66+
67+
message RenewRefreshTokenRes {
68+
message Data {
69+
string description = 1;
70+
int32 error_code = 2;
71+
int64 expires_in = 3;
72+
string refresh_token = 4;
73+
}
74+
string message = 1;
75+
Data data = 2;
76+
}
77+
78+
message GetClientTokenReq {
79+
string client_key = 1;
80+
string client_secret = 2;
81+
string grant_type = 3;
82+
}
83+
84+
message GetClientTokenRes {
85+
message Data {
86+
int64 expires_in = 1;
87+
string access_token = 2;
88+
string description = 3;
89+
int64 error_code = 4;
90+
}
91+
string message = 1;
92+
Data data = 2;
93+
}
94+
95+
message RefreshAccessTokenReq {
96+
string client_key = 1;
97+
string grant_type = 2;
98+
string refresh_token = 3;
99+
}
100+
101+
message RefreshAccessTokenRes {
102+
message Data {
103+
string refresh_token = 1;
104+
string scope = 2;
105+
string access_token = 3;
106+
string description = 4;
107+
int32 error_code = 5;
108+
int64 expires_in = 6;
109+
string open_id = 7;
110+
int64 refresh_expires_in = 8;
111+
}
112+
string message = 1;
113+
Data data = 2;
114+
}

douyin-webapp/permission.proto

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)