Skip to content

Commit 5cb3225

Browse files
More authentication endpoints
Addresses #38
1 parent 801d07e commit 5cb3225

15 files changed

Lines changed: 303 additions & 2 deletions

openapi/components/codeSamples/authentication.yaml

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,37 @@
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/resendEmail:
32+
post:
33+
- lang: cURL
34+
source: >-
35+
curl -X POST "https://api.vrchat.cloud/api/1/auth/resendEmail" \
36+
-H "Content-Type: application/json" \
37+
--data '{}'
38+
/auth/confirmEmail:
39+
get:
40+
- lang: cURL
41+
source: >-
42+
curl -X GET "https://api.vrchat.cloud/api/1/auth/confirmEmail?id={userId}&verify_email={token}"
43+
/auth/verifyLoginPlace:
44+
get:
45+
- lang: cURL
46+
source: >-
47+
curl -X GET "https://api.vrchat.cloud/api/1/auth/verifyLoginPlace?userId={userId}&token={token}"
48+
/auth/twofactorauth:
49+
delete:
50+
- lang: cURL
51+
source: >-
52+
curl -X DELETE "https://api.vrchat.cloud/api/1/auth/twofactorauth" \
53+
-b "auth={authCookie}"
2454
/auth/twofactorauth/totp/verify:
2555
post:
2656
- lang: cURL
@@ -29,6 +59,20 @@
2959
-H "Content-Type: application/json" \
3060
-b "auth={authCookie}" \
3161
--data '{"code": "string"}'
62+
/auth/twofactorauth/totp/pending:
63+
post:
64+
- lang: cURL
65+
source: >-
66+
curl -X POST "https://api.vrchat.cloud/api/1/auth/twofactorauth/totp/pending" \
67+
-b "auth={authCookie}"
68+
/auth/twofactorauth/totp/pending/verify:
69+
post:
70+
- lang: cURL
71+
source: >-
72+
curl -X POST "https://api.vrchat.cloud/api/1/auth/twofactorauth/totp/pending/verify" \
73+
-H "Content-Type: application/json" \
74+
-b "auth={authCookie}" \
75+
--data '{"code": "string"}'
3276
/auth/user/twofactorauth/otp:
3377
get:
3478
- 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/resendEmail":
34+
$ref: "./paths/authentication.yaml#/paths/~1auth~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: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,47 @@ 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+
/auth/twofactorauth/totp/pending/verify:
133+
post:
134+
summary: Verify Pending 2FA code
135+
operationId: verifyPending2FA
136+
x-codeSamples:
137+
$ref: "../codeSamples/authentication.yaml#/~1auth~1twofactorauth~1totp~1pending~1verify/post"
138+
responses:
139+
'200':
140+
$ref: ../responses/authentication/Verify2FAResponse.yaml
141+
'401':
142+
$ref: ../responses/MissingCredentialsError.yaml
143+
requestBody:
144+
required: true
145+
content:
146+
application/json:
147+
schema:
148+
$ref: ../requests/TwoFactorAuthCode.yaml
149+
examples: {}
150+
description: Finishes sequence for enabling time-based 2FA.
151+
tags:
152+
- authentication
153+
security:
154+
- authCookie: []
155+
parameters: []
115156
/auth/user/twofactorauth/otp:
116157
get:
117158
summary: Get 2FA Recovery codes
@@ -175,6 +216,22 @@ paths:
175216
security:
176217
- authCookie: [ ]
177218
parameters: [ ]
219+
'/auth/twofactorauth':
220+
delete:
221+
summary: Disable 2FA
222+
operationId: disable2FA
223+
x-codeSamples:
224+
$ref: "../codeSamples/authentication.yaml#/~1auth~1twofactorauth/delete"
225+
responses:
226+
'200':
227+
$ref: ../responses/authentication/Disable2FAResponse.yaml
228+
'401':
229+
$ref: ../responses/MissingCredentialsError.yaml
230+
tags:
231+
- authentication
232+
description: Disables 2FA for the currently logged in account
233+
security:
234+
- authCookie: []
178235
'/users/{userId}/delete':
179236
parameters:
180237
- $ref: ../parameters.yaml#/userId
@@ -198,6 +255,76 @@ paths:
198255
**METHOD NOTE:** Despite this being a Delete action, the method type required is PUT.
199256
security:
200257
- authCookie: []
258+
/auth/register:
259+
post:
260+
summary: Register User Account
261+
description: Verify whether the currently provided Auth Token is valid.
262+
requestBody:
263+
required: true
264+
content:
265+
application/json:
266+
schema:
267+
$ref: ../requests/RegisterUserAccountRequest.yaml
268+
responses:
269+
'200':
270+
$ref: ../responses/authentication/CurrentUserLoginResponse.yaml
271+
'401':
272+
$ref: ../responses/MissingCredentialsError.yaml
273+
operationId: registerUserAccount
274+
parameters: []
275+
tags:
276+
- authentication
277+
/auth/resendEmail:
278+
post:
279+
summary: Resend Email Confirmation
280+
description: Verify whether the currently provided Auth Token is valid.
281+
requestBody:
282+
required: true
283+
content:
284+
application/json:
285+
schema:
286+
$ref: ../requests/ResendEmailConfirmationRequest.yaml
287+
responses:
288+
'200':
289+
$ref: ../responses/authentication/ResendVerificationEmailSuccess.yaml
290+
'401':
291+
$ref: ../responses/MissingCredentialsError.yaml
292+
operationId: resendEmailConfirmation
293+
parameters: []
294+
tags:
295+
- authentication
296+
security:
297+
- authCookie: []
298+
'/auth/confirmEmail':
299+
get:
300+
summary: Confirm Email
301+
operationId: confirmEmail
302+
parameters:
303+
- $ref: ../parameters.yaml#/confirmEmailUserId
304+
- $ref: ../parameters.yaml#/confirmEmailToken
305+
x-codeSamples:
306+
$ref: "../codeSamples/authentication.yaml#/~1auth~1confirmEmail/get"
307+
responses:
308+
'302':
309+
$ref: ../responses/authentication/ConfirmEmailResponse.yaml
310+
tags:
311+
- authentication
312+
description: Confirms the email address for a user
313+
'/auth/verifyLoginPlace':
314+
get:
315+
summary: Verify Login Place
316+
operationId: verifyLoginPlace
317+
parameters:
318+
- $ref: ../parameters.yaml#/userIdQuery
319+
- $ref: ../parameters.yaml#/verifyLoginPlaceToken
320+
x-codeSamples:
321+
$ref: "../codeSamples/authentication.yaml#/~1auth~1verifyLoginPlace/get"
322+
responses:
323+
'302':
324+
$ref: ../responses/authentication/ConfirmLoginResponse.yaml
325+
tags:
326+
- authentication
327+
description: Verifies a login attempt for a user
201328
tags:
202329
$ref: ../tags.yaml
203330
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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
title: ResendEmailConfirmationRequest
2+
type: object
3+
properties: {}
4+
required: {}
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

0 commit comments

Comments
 (0)