4
4
5
5
Request body
6
6
7
- | KEY | EXAMPLE |
8
- | -------- | ------------------- |
9
- | username | kyon777 |
10
- | password | imjohnsmith777 |
11
-
7
+ | KEY | EXAMPLE |
8
+ | -------------------- | ------------------------------------------------------------ |
9
+ | username | kyon777 |
10
+ | password | imjohnsmith777 |
11
+
12
+ | g-recaptcha-response | 03AJpayVF6YpF1BGU-kZqEwN6G2k7cOv16_Q-SvK8zOUHrtkqdlVrIf9BJhEnbecV7PwAgCSF1JKUC3Gr5AQILxBuSrKKZrvkHQlm2pZfnTFWuyq0rYID2oUhlsKxVA4FY03GEJV-BCaciZphPDZpvid9t9ompoh8HS0_iKP9EgD9ju7ksqSiy9XcVkHfOy7BQJ2qEeaR2qHxrG2wFLC6w0D4bG8dySX9VgKeMW_pvXnni9ZMLXIVcTz4WpDtaELvRaIc02wWjgmvZZ8DXJ0on2B7T1IACOFYu5dvDVRJz3DsRvs8nYIbz1MwRfzQGVycQz5p5Z8b1lwhkVotYlaetMS3A79ECfJPXOJs4_Hrd5q9TofiYOIbqFPk |
12
13
13
14
!> Password stored in the database was encrypted by [ bcryptjs] ( https://github.com/dcodeIO/bcrypt.js ) , not the original password, feel free to use it.
14
15
16
+ Possible response
17
+
18
+ | code | message | note |
19
+ | ------- | ------------------------------------------------------------ | ------ |
20
+ | 1120001 | register successfully. | |
21
+ | 1140001 | [ username] is empty, please provide a correct one. | |
22
+ | 1140002 | [ username] must be at least 5 at most 15 characters long, please try another. | |
23
+ | 1140003 | [ password] is empty, please provide a correct one. | |
24
+ | 1140004 | [ password] must be at least 6 at most 17 characters long, please try another. | |
25
+ | 1140005 | [ email] is empty, please provide a correct one. | |
26
+ | 1140006 | [ email] is not in correct format, please try another. | |
27
+ | 1940101 | Google reCAPTCHA verification failed. | common |
28
+ | 1140901 | This username has been registered. | |
29
+ | 1950301 | internal server error, database error. | common |
30
+
15
31
Example request
16
32
17
33
``` bash
18
- curl -d
" username=kyon777&password=imjohnsmith777&[email protected] " " https://animeloop.org/api/v2/auth/register"
34
+ curl -d
" username=kyon777&password=imjohnsmith777&[email protected] &g-recaptcha-response=03AJpayVF6YpF1BGU-kZqEwN6G2k7cOv16_Q-SvK8zOUHrtkqdlVrIf9BJhEnbecV7PwAgCSF1JKUC3Gr5AQILxBuSrKKZrvkHQlm2pZfnTFWuyq0rYID2oUhlsKxVA4FY03GEJV-BCaciZphPDZpvid9t9ompoh8HS0_iKP9EgD9ju7ksqSiy9XcVkHfOy7BQJ2qEeaR2qHxrG2wFLC6w0D4bG8dySX9VgKeMW_pvXnni9ZMLXIVcTz4WpDtaELvRaIc02wWjgmvZZ8DXJ0on2B7T1IACOFYu5dvDVRJz3DsRvs8nYIbz1MwRfzQGVycQz5p5Z8b1lwhkVotYlaetMS3A79ECfJPXOJs4_Hrd5q9TofiYOIbqFPk " " https://animeloop.org/api/v2/auth/register"
19
35
```
20
36
21
37
Example response
22
38
23
39
``` json
24
40
{
25
41
"status" : " success" ,
26
- "code" : 200 ,
42
+ "code" : 1120001 ,
27
43
"message" : " register successfully." ,
28
44
"data" : {}
29
45
}
@@ -42,6 +58,16 @@ Request body
42
58
43
59
?> When you sign up for an account, the system will automatically send an email to the email address you provided, so you do not need to call this interface manually.
44
60
61
+ Possible response
62
+
63
+ | code | message | note |
64
+ | ------- | --------------------------------------- | ------ |
65
+ | 1420002 | send verification email successfully. | |
66
+ | 1420003 | this account has already been verified. | |
67
+ | 1440003 | empty username or password. | |
68
+ | 1440004 | incorrect username or password. | |
69
+ | 1950301 | internal server error, database error. | common |
70
+
45
71
Example request
46
72
47
73
``` bash
@@ -53,8 +79,8 @@ Example response
53
79
``` json
54
80
{
55
81
"status" : " success" ,
56
- "code" : 200 ,
57
- "message" : " send email successfully." ,
82
+ "code" : 1420002 ,
83
+ "message" : " send verification email successfully." ,
58
84
"data" : {}
59
85
}
60
86
```
@@ -65,7 +91,14 @@ Example response
65
91
66
92
?> In the mailbox check the verification email with a verify url, You do not need to manually call this interface.
67
93
68
- Example request
94
+ | code | message | note |
95
+ | ------- | ------------------------------------------------ | ------ |
96
+ | 1420001 | verify account successfully. | |
97
+ | 1440001 | [ code] is empty, please provide a correct one. | |
98
+ | 1440002 | [ code] is invalid, please provide a correct one. | |
99
+ | 1950301 | internal server error, database error. | common |
100
+
101
+ Example request
69
102
70
103
``` bash
71
104
curl https://animeloop.org/api/v2/auth/verify? code=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY3Rpb24iOiJ2ZXJpZnkiLCJ1c2VybmFtZSI6InNxaW5jdXJyeTIiLCJkYXRlIjoiMjAxOC0wMS0yN1QwNToyMDozMC40NjhaIn0.JZ8xpCqusaAw_swnHT4bKXfjyxBxfHz0HyBkmVVoe-A
@@ -76,8 +109,92 @@ Example response
76
109
``` json
77
110
{
78
111
"status" : " success" ,
79
- "code" : 200 ,
80
- "message" : " send email successfully." ,
112
+ "code" : 1420001 ,
113
+ "message" : " verify account successfully." ,
81
114
"data" : {}
82
115
}
83
116
```
117
+
118
+ ## login
119
+
120
+ ** ` POST /auth/login ` **
121
+
122
+ Request body
123
+
124
+ | KEY | eXAMPLE |
125
+ | -------------------- | ------------------------------------------------------------ |
126
+ | username | kyon777 |
127
+ | password | imjohnsmith777 |
128
+ | g-recaptcha-response | 03AJpayVF6YpF1BGU-kZqEwN6G2k7cOv16_Q-SvK8zOUHrtkqdlVrIf9BJhEnbecV7PwAgCSF1JKUC3Gr5AQILxBuSrKKZrvkHQlm2pZfnTFWuyq0rYID2oUhlsKxVA4FY03GEJV-BCaciZphPDZpvid9t9ompoh8HS0_iKP9EgD9ju7ksqSiy9XcVkHfOy7BQJ2qEeaR2qHxrG2wFLC6w0D4bG8dySX9VgKeMW_pvXnni9ZMLXIVcTz4WpDtaELvRaIc02wWjgmvZZ8DXJ0on2B7T1IACOFYu5dvDVRJz3DsRvs8nYIbz1MwRfzQGVycQz5p5Z8b1lwhkVotYlaetMS3A79ECfJPXOJs4_Hrd5q9TofiYOIbqFPk |
129
+
130
+ !> The response of this request contains a session cookie.
131
+
132
+ Possible response
133
+
134
+ | code | message | note |
135
+ | ------- | -------------------------------------- | ------ |
136
+ | 1220001 | login successfully. | |
137
+ | 1240101 | incorrect username or password. | |
138
+ | 1240102 | this account has not yet verified. | |
139
+ | 1940101 | Google reCAPTCHA verification failed. | common |
140
+ | 1950301 | internal server error, database error. | common |
141
+
142
+ Example request
143
+
144
+ ``` bash
145
+ curl -d " username=kyon777&password=imjohnsmith777&g-recaptcha-response=03AJpayVF6YpF1BGU-kZqEwN6G2k7cOv16_Q-SvK8zOUHrtkqdlVrIf9BJhEnbecV7PwAgCSF1JKUC3Gr5AQILxBuSrKKZrvkHQlm2pZfnTFWuyq0rYID2oUhlsKxVA4FY03GEJV-BCaciZphPDZpvid9t9ompoh8HS0_iKP9EgD9ju7ksqSiy9XcVkHfOy7BQJ2qEeaR2qHxrG2wFLC6w0D4bG8dySX9VgKeMW_pvXnni9ZMLXIVcTz4WpDtaELvRaIc02wWjgmvZZ8DXJ0on2B7T1IACOFYu5dvDVRJz3DsRvs8nYIbz1MwRfzQGVycQz5p5Z8b1lwhkVotYlaetMS3A79ECfJPXOJs4_Hrd5q9TofiYOIbqFPk" " https://animeloop.org/api/v2/auth/login"
146
+ ```
147
+
148
+ Example response
149
+
150
+ ``` json
151
+ // response contains auth session cookie [animeloop.auth.sid=s%3A4VtJUXAabKIew3Wib8scACX1lDZK6Z3d.7Hqy%2F8Nk8d0rFr4ygSCoEnwg5GD%2BVMfghQieThqQ2dU]
152
+
153
+ {
154
+ "status" : " success" ,
155
+ "code" : 1220001 ,
156
+ "message" : " login successfully." ,
157
+ "data" : {}
158
+ }
159
+ ```
160
+
161
+ ## Logout
162
+
163
+ ** ` POST /auth/logout ` **
164
+
165
+ Request cookies
166
+
167
+ | KEY | EXAMPLE |
168
+ | ------------------ | ------------------------------------------------------------ |
169
+ | animeloop.auth.sid | s%3A4VtJUXAabKIew3Wib8scACX1lDZK6Z3d.7Hqy%2F8Nk8d0rFr4ygSCoEnwg5GD%2BVMfghQieThqQ2dU |
170
+
171
+ !> These requests have an empty body, authentication works with session cookie from login api.
172
+
173
+ Possible response
174
+
175
+ | code | message | note |
176
+ | ------- | -------------------------------------- | ------ |
177
+ | 1220002 | logout successfully. | |
178
+ | 1940102 | cookie session validation failed. | common |
179
+ | 1940103 | cookie session doesn't exist. | common |
180
+ | 1950301 | internal server error, database error. | common |
181
+
182
+ Example request
183
+
184
+ ``` bash
185
+ curl --cookie " animeloop.auth.sid=s%3A4VtJUXAabKIew3Wib8scACX1lDZK6Z3d.7Hqy%2F8Nk8d0rFr4ygSCoEnwg5GD%2BVMfghQieThqQ2dU" " https://animeloop.org/api/v2/auth/logout"
186
+ ```
187
+
188
+ Example response
189
+
190
+ ``` json
191
+ // response contains auth session cookie [animeloop.auth.sid=s%3A4VtJUXAabKIew3Wib8scACX1lDZK6Z3d.7Hqy%2F8Nk8d0rFr4ygSCoEnwg5GD%2BVMfghQieThqQ2dU]
192
+
193
+ {
194
+ "status" : " success" ,
195
+ "code" : 1220002 ,
196
+ "message" : " logout successfully." ,
197
+ "data" : {}
198
+ }
199
+ ```
200
+
0 commit comments