Skip to content

Commit d66f8be

Browse files
More authentication endpoints (#467)
* More authentication endpoints Addresses #38 * Fix typos * Update ResendEmailConfirmationRequest.yaml * Fix mistakes, add delete totp pending, change descriptions Added `DELETE /auth/twofactorauth/totp/pending` Fixed `POST /auth/user/resendEmail` request path Removed `POST /auth/user/resendEmail` empty request body Marked `POST /auth/register` as deprecated Changed descriptions for endpoints
1 parent 414463f commit d66f8be

14 files changed

Lines changed: 318 additions & 2 deletions

openapi/components/codeSamples/authentication.yaml

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,35 @@
2020
get:
2121
- lang: cURL
2222
source: >-
23-
curl -X GET "https://api.vrchat.cloud/api/1/auth/exists?email={string}"
23+
curl -X GET "https://api.vrchat.cloud/api/1/auth/exists?email={string}"
24+
/auth/register:
25+
post:
26+
- lang: cURL
27+
source: >-
28+
curl -X POST "https://api.vrchat.cloud/api/1/auth/register" \
29+
-H "Content-Type: application/json" \
30+
--data '{"username": "{userAndDisplayName}", "password": "{password}", "email": "{emailAddress}", "year": "{birthYear}", "month": "{birthMonth}", "day": "{birthDay}", "captchaCode": "{captchaCode}", "subscribe": true, "acceptedTOSVersion": 10}'
31+
/auth/user/resendEmail:
32+
post:
33+
- lang: cURL
34+
source: >-
35+
curl -X POST "https://api.vrchat.cloud/api/1/auth/user/resendEmail"
36+
/auth/confirmEmail:
37+
get:
38+
- lang: cURL
39+
source: >-
40+
curl -X GET "https://api.vrchat.cloud/api/1/auth/confirmEmail?id={userId}&verify_email={token}"
41+
/auth/verifyLoginPlace:
42+
get:
43+
- lang: cURL
44+
source: >-
45+
curl -X GET "https://api.vrchat.cloud/api/1/auth/verifyLoginPlace?userId={userId}&token={token}"
46+
/auth/twofactorauth:
47+
delete:
48+
- lang: cURL
49+
source: >-
50+
curl -X DELETE "https://api.vrchat.cloud/api/1/auth/twofactorauth" \
51+
-b "auth={authCookie}"
2452
/auth/twofactorauth/totp/verify:
2553
post:
2654
- lang: cURL
@@ -29,6 +57,25 @@
2957
-H "Content-Type: application/json" \
3058
-b "auth={authCookie}" \
3159
--data '{"code": "string"}'
60+
/auth/twofactorauth/totp/pending:
61+
post:
62+
- lang: cURL
63+
source: >-
64+
curl -X POST "https://api.vrchat.cloud/api/1/auth/twofactorauth/totp/pending" \
65+
-b "auth={authCookie}"
66+
delete:
67+
- lang: cURL
68+
source: >-
69+
curl -X DELETE "https://api.vrchat.cloud/api/1/auth/twofactorauth/totp/pending" \
70+
-b "auth={authCookie}"
71+
/auth/twofactorauth/totp/pending/verify:
72+
post:
73+
- lang: cURL
74+
source: >-
75+
curl -X POST "https://api.vrchat.cloud/api/1/auth/twofactorauth/totp/pending/verify" \
76+
-H "Content-Type: application/json" \
77+
-b "auth={authCookie}" \
78+
--data '{"code": "string"}'
3279
/auth/user/twofactorauth/otp:
3380
get:
3481
- lang: cURL

openapi/components/parameters.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,4 +453,27 @@ printId:
453453
schema:
454454
type: string
455455
example: 'prnt_0a0aa0a0-85ea-42eb-b2f7-4840d7f341fa'
456-
description: Print ID.
456+
description: Print ID.
457+
confirmEmailUserId:
458+
name: id
459+
in: query
460+
required: true
461+
schema:
462+
type: string
463+
example: 'usr_00000000-0000-0000-0000-000000000000'
464+
description: 'Target user for which to verify email.'
465+
confirmEmailToken:
466+
name: verify_email
467+
in: query
468+
required: true
469+
schema:
470+
type: string
471+
example: 'eml_00000000-0000-0000-0000-000000000000'
472+
description: 'Token to verify email.'
473+
verifyLoginPlaceToken:
474+
name: token
475+
in: query
476+
required: true
477+
schema:
478+
type: string
479+
description: 'Token to verify login attempt.'

openapi/components/paths.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@
88
$ref: "./paths/authentication.yaml#/paths/~1auth~1exists"
99
"/auth/user":
1010
$ref: "./paths/authentication.yaml#/paths/~1auth~1user"
11+
"/auth/twofactorauth":
12+
$ref: "./paths/authentication.yaml#/paths/~1auth~1twofactorauth"
1113
"/auth/twofactorauth/totp/verify":
1214
$ref: "./paths/authentication.yaml#/paths/~1auth~1twofactorauth~1totp~1verify"
15+
"/auth/twofactorauth/totp/pending":
16+
$ref: "./paths/authentication.yaml#/paths/~1auth~1twofactorauth~1totp~1pending"
17+
"/auth/twofactorauth/totp/pending/verify":
18+
$ref: "./paths/authentication.yaml#/paths/~1auth~1twofactorauth~1totp~1pending~1verify"
1319
"/auth/user/twofactorauth/otp":
1420
$ref: "./paths/authentication.yaml#/paths/~1auth~1user~1twofactorauth~1otp"
1521
"/auth/twofactorauth/otp/verify":
@@ -22,6 +28,14 @@
2228
$ref: "./paths/authentication.yaml#/paths/~1logout"
2329
"/users/{userId}/delete":
2430
$ref: "./paths/authentication.yaml#/paths/~1users~1{userId}~1delete"
31+
"/auth/register":
32+
$ref: "./paths/authentication.yaml#/paths/~1auth~1register"
33+
"/auth/user/resendEmail":
34+
$ref: "./paths/authentication.yaml#/paths/~1auth~1user~1resendEmail"
35+
"/auth/confirmEmail":
36+
$ref: "./paths/authentication.yaml#/paths/~1auth~1confirmEmail"
37+
"/auth/verifyLoginPlace":
38+
$ref: "./paths/authentication.yaml#/paths/~1auth~1verifyLoginPlace"
2539

2640
# avatars
2741

openapi/components/paths/authentication.yaml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,63 @@ paths:
112112
security:
113113
- authCookie: []
114114
parameters: []
115+
/auth/twofactorauth/totp/pending:
116+
post:
117+
summary: Enable time-based 2FA codes
118+
operationId: enable2FA
119+
x-codeSamples:
120+
$ref: "../codeSamples/authentication.yaml#/~1auth~1twofactorauth~1totp~1pending/post"
121+
responses:
122+
'200':
123+
$ref: ../responses/authentication/Pending2FAResponse.yaml
124+
'401':
125+
$ref: ../responses/MissingCredentialsError.yaml
126+
description: Begins the sequence for enabling time-based 2FA.
127+
tags:
128+
- authentication
129+
security:
130+
- authCookie: []
131+
parameters: []
132+
delete:
133+
summary: Cancel pending enabling of time-based 2FA codes
134+
operationId: cancelPending2FA
135+
x-codeSamples:
136+
$ref: "../codeSamples/authentication.yaml#/~1auth~1twofactorauth~1totp~1pending/delete"
137+
responses:
138+
'200':
139+
$ref: ../responses/authentication/Disable2FAResponse.yaml
140+
'401':
141+
$ref: ../responses/MissingCredentialsError.yaml
142+
description: Cancels the sequence for enabling time-based 2FA.
143+
tags:
144+
- authentication
145+
security:
146+
- authCookie: []
147+
parameters: []
148+
/auth/twofactorauth/totp/pending/verify:
149+
post:
150+
summary: Verify Pending 2FA code
151+
operationId: verifyPending2FA
152+
x-codeSamples:
153+
$ref: "../codeSamples/authentication.yaml#/~1auth~1twofactorauth~1totp~1pending~1verify/post"
154+
responses:
155+
'200':
156+
$ref: ../responses/authentication/Verify2FAResponse.yaml
157+
'401':
158+
$ref: ../responses/MissingCredentialsError.yaml
159+
requestBody:
160+
required: true
161+
content:
162+
application/json:
163+
schema:
164+
$ref: ../requests/TwoFactorAuthCode.yaml
165+
examples: {}
166+
description: Finishes sequence for enabling time-based 2FA.
167+
tags:
168+
- authentication
169+
security:
170+
- authCookie: []
171+
parameters: []
115172
/auth/user/twofactorauth/otp:
116173
get:
117174
summary: Get 2FA Recovery codes
@@ -175,6 +232,22 @@ paths:
175232
security:
176233
- authCookie: [ ]
177234
parameters: [ ]
235+
'/auth/twofactorauth':
236+
delete:
237+
summary: Disable 2FA
238+
operationId: disable2FA
239+
x-codeSamples:
240+
$ref: "../codeSamples/authentication.yaml#/~1auth~1twofactorauth/delete"
241+
responses:
242+
'200':
243+
$ref: ../responses/authentication/Disable2FAResponse.yaml
244+
'401':
245+
$ref: ../responses/MissingCredentialsError.yaml
246+
tags:
247+
- authentication
248+
description: Disables 2FA for the currently logged in account
249+
security:
250+
- authCookie: []
178251
'/users/{userId}/delete':
179252
parameters:
180253
- $ref: ../parameters.yaml#/userId
@@ -198,6 +271,76 @@ paths:
198271
**METHOD NOTE:** Despite this being a Delete action, the method type required is PUT.
199272
security:
200273
- authCookie: []
274+
/auth/register:
275+
post:
276+
summary: Register User Account
277+
description: |-
278+
~~Register a new user account.~~
279+
280+
**DEPRECATED:** Automated creation of accounts has no legitimate public third-party use case, and would be in violation of ToS §13.2:
281+
*By using the Platform, you agree not to: i. [...] use the Platform in a manner inconsistent with individual human usage*
282+
This endpoint is documented in the interest of completeness
283+
requestBody:
284+
required: true
285+
content:
286+
application/json:
287+
schema:
288+
$ref: ../requests/RegisterUserAccountRequest.yaml
289+
responses:
290+
'200':
291+
$ref: ../responses/authentication/CurrentUserLoginResponse.yaml
292+
'401':
293+
$ref: ../responses/MissingCredentialsError.yaml
294+
operationId: registerUserAccount
295+
parameters: []
296+
tags:
297+
- authentication
298+
deprecated: true
299+
/auth/user/resendEmail:
300+
post:
301+
summary: Resend Email Confirmation
302+
description: Requests a resend of pending email address confirmation email
303+
responses:
304+
'200':
305+
$ref: ../responses/authentication/ResendVerificationEmailSuccess.yaml
306+
'401':
307+
$ref: ../responses/MissingCredentialsError.yaml
308+
operationId: resendEmailConfirmation
309+
parameters: []
310+
tags:
311+
- authentication
312+
security:
313+
- authCookie: []
314+
'/auth/confirmEmail':
315+
get:
316+
summary: Confirm Email
317+
operationId: confirmEmail
318+
parameters:
319+
- $ref: ../parameters.yaml#/confirmEmailUserId
320+
- $ref: ../parameters.yaml#/confirmEmailToken
321+
x-codeSamples:
322+
$ref: "../codeSamples/authentication.yaml#/~1auth~1confirmEmail/get"
323+
responses:
324+
'302':
325+
$ref: ../responses/authentication/ConfirmEmailResponse.yaml
326+
tags:
327+
- authentication
328+
description: Confirms the email address for a user
329+
'/auth/verifyLoginPlace':
330+
get:
331+
summary: Verify Login Place
332+
operationId: verifyLoginPlace
333+
parameters:
334+
- $ref: ../parameters.yaml#/userIdQuery
335+
- $ref: ../parameters.yaml#/verifyLoginPlaceToken
336+
x-codeSamples:
337+
$ref: "../codeSamples/authentication.yaml#/~1auth~1verifyLoginPlace/get"
338+
responses:
339+
'302':
340+
$ref: ../responses/authentication/VerifyLoginPlaceResponse.yaml
341+
tags:
342+
- authentication
343+
description: Verifies a login attempt for a user
201344
tags:
202345
$ref: ../tags.yaml
203346
components:
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
title: RegisterUserAccountRequest
2+
type: object
3+
properties:
4+
username:
5+
description: Display Name / Username (Username is a sanitized version)
6+
type: string
7+
minLength: 4
8+
maxLength: 15
9+
password:
10+
description: Password
11+
type: string
12+
minLength: 8
13+
email:
14+
description: Email address
15+
type: string
16+
year:
17+
description: Birth year
18+
type: string
19+
month:
20+
description: Birth month of year
21+
type: string
22+
day:
23+
description: Birth day of month
24+
type: string
25+
captchaCode:
26+
description: Captcha code
27+
type: string
28+
subscribe:
29+
description: Whether to recieve promotional emails
30+
type: boolean
31+
acceptedTOSVersion:
32+
description: The most recent version of the TOS
33+
type: integer
34+
required:
35+
- username
36+
- password
37+
- email
38+
- year
39+
- month
40+
- day
41+
- captchaCode
42+
- subscribe
43+
- acceptedTOSVersion
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
description: OK
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
description: OK
2+
content:
3+
application/json:
4+
schema:
5+
$ref: ../../schemas/Disable2FAResult.yaml
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
description: OK
2+
content:
3+
application/json:
4+
schema:
5+
$ref: ../../schemas/Pending2FAResult.yaml
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
description: OK
2+
content:
3+
application/json:
4+
schema:
5+
$ref: ../../schemas/Success.yaml
6+
examples:
7+
Resend Verification Email Success:
8+
value:
9+
success:
10+
message: Verification Email Sent!
11+
status_code: 200
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
description: OK

0 commit comments

Comments
 (0)