Skip to content

Latest commit

 

History

History
784 lines (628 loc) · 27 KB

AuthenticationApi.md

File metadata and controls

784 lines (628 loc) · 27 KB

VRChat.API.Api.AuthenticationApi

All URIs are relative to https://api.vrchat.cloud/api/1

Method HTTP request Description
CheckUserExists GET /auth/exists Check User Exists
DeleteUser PUT /users/{userId}/delete Delete User
GetCurrentUser GET /auth/user Login and/or Get Current User Info
Logout PUT /logout Logout
Verify2FA POST /auth/twofactorauth/totp/verify Verify 2FA code
Verify2FAEmailCode POST /auth/twofactorauth/emailotp/verify Verify 2FA email code
VerifyAuthToken GET /auth Verify Auth Token
VerifyRecoveryCode POST /auth/twofactorauth/otp/verify Verify 2FA code with Recovery code

CheckUserExists

UserExists CheckUserExists (string email = null, string displayName = null, string username = null, string excludeUserId = null)

Check User Exists

Checks if a user by a given username, displayName or email exist. This is used during registration to check if a username has already been taken, during change of displayName to check if a displayName is available, and during change of email to check if the email is already used. In the later two cases the excludeUserId is used to exclude oneself, otherwise the result would always be true. It is REQUIRED to include AT LEAST username, displayName or email query parameter. Although they can be combined - in addition with excludeUserId (generally to exclude yourself) - to further fine-tune the search.

Example

using System.Collections.Generic;
using System.Diagnostics;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

namespace Example
{
    public class CheckUserExistsExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vrchat.cloud/api/1";
            var apiInstance = new AuthenticationApi(config);
            var email = "email_example";  // string | Filter by email. (optional) 
            var displayName = "displayName_example";  // string | Filter by displayName. (optional) 
            var username = "username_example";  // string | Filter by Username. (optional) 
            var excludeUserId = "excludeUserId_example";  // string | Exclude by UserID. (optional) 

            try
            {
                // Check User Exists
                UserExists result = apiInstance.CheckUserExists(email, displayName, username, excludeUserId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AuthenticationApi.CheckUserExists: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CheckUserExistsWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Check User Exists
    ApiResponse<UserExists> response = apiInstance.CheckUserExistsWithHttpInfo(email, displayName, username, excludeUserId);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling AuthenticationApi.CheckUserExistsWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
email string Filter by email. [optional]
displayName string Filter by displayName. [optional]
username string Filter by Username. [optional]
excludeUserId string Exclude by UserID. [optional]

Return type

UserExists

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Returns a response if a user exists or not. -
400 Error response when missing at least 1 of the required parameters. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

DeleteUser

CurrentUser DeleteUser (string userId)

Delete User

Deletes the account with given ID. Normal users only have permission to delete their own account. Account deletion is 14 days from this request, and will be cancelled if you do an authenticated request with the account afterwards. VRC+ NOTE: Despite the 14-days cooldown, any VRC+ subscription will be cancelled immediately. METHOD NOTE: Despite this being a Delete action, the method type required is PUT.

Example

using System.Collections.Generic;
using System.Diagnostics;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

namespace Example
{
    public class DeleteUserExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vrchat.cloud/api/1";
            // Configure API key authorization: authCookie
            config.AddApiKey("auth", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("auth", "Bearer");

            var apiInstance = new AuthenticationApi(config);
            var userId = "userId_example";  // string | Must be a valid user ID.

            try
            {
                // Delete User
                CurrentUser result = apiInstance.DeleteUser(userId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AuthenticationApi.DeleteUser: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the DeleteUserWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Delete User
    ApiResponse<CurrentUser> response = apiInstance.DeleteUserWithHttpInfo(userId);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling AuthenticationApi.DeleteUserWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
userId string Must be a valid user ID.

Return type

CurrentUser

Authorization

authCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
401 Error response due to missing auth cookie. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetCurrentUser

CurrentUser GetCurrentUser ()

Login and/or Get Current User Info

This endpoint does the following two operations: 1) Checks if you are already logged in by looking for a valid auth cookie. If you are have a valid auth cookie then no additional auth-related actions are taken. If you are not logged in then it will log you in with the Authorization header and set the auth cookie. The auth cookie will only be sent once. 2) If logged in, this function will also return the CurrentUser object containing detailed information about the currently logged in user. The auth string after Authorization: Basic {string} is a base64-encoded string of the username and password, both individually url-encoded, and then joined with a colon. > base64(urlencode(username):urlencode(password)) WARNING: Session Limit: Each authentication with login credentials counts as a separate session, out of which you have a limited amount. Make sure to save and reuse the auth cookie if you are often restarting the program. The provided API libraries automatically save cookies during runtime, but does not persist during restart. While it can be fine to use username/password during development, expect in production to very fast run into the rate-limit and be temporarily blocked from making new sessions until older ones expire. The exact number of simultaneous sessions is unknown/undisclosed.

Example

using System.Collections.Generic;
using System.Diagnostics;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

namespace Example
{
    public class GetCurrentUserExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vrchat.cloud/api/1";
            // Configure API key authorization: authCookie
            config.AddApiKey("auth", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("auth", "Bearer");
            // Configure HTTP basic authorization: authHeader
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";
            // Configure API key authorization: twoFactorAuthCookie
            config.AddApiKey("twoFactorAuth", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("twoFactorAuth", "Bearer");

            var apiInstance = new AuthenticationApi(config);

            try
            {
                // Login and/or Get Current User Info
                CurrentUser result = apiInstance.GetCurrentUser();
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AuthenticationApi.GetCurrentUser: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetCurrentUserWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Login and/or Get Current User Info
    ApiResponse<CurrentUser> response = apiInstance.GetCurrentUserWithHttpInfo();
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling AuthenticationApi.GetCurrentUserWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

This endpoint does not need any parameter.

Return type

CurrentUser

Authorization

authCookie, authHeader, twoFactorAuthCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK * Set-Cookie - Successful authentication returns an `auth` cookie.
401 Error response due to missing auth cookie. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

Logout

Success Logout ()

Logout

Invalidates the login session.

Example

using System.Collections.Generic;
using System.Diagnostics;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

namespace Example
{
    public class LogoutExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vrchat.cloud/api/1";
            // Configure API key authorization: authCookie
            config.AddApiKey("auth", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("auth", "Bearer");

            var apiInstance = new AuthenticationApi(config);

            try
            {
                // Logout
                Success result = apiInstance.Logout();
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AuthenticationApi.Logout: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the LogoutWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Logout
    ApiResponse<Success> response = apiInstance.LogoutWithHttpInfo();
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling AuthenticationApi.LogoutWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

This endpoint does not need any parameter.

Return type

Success

Authorization

authCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK * Set-Cookie - Clears the `auth` cookie.
* \0Set-Cookie - Clears the `age` cookie.
* \0\0Set-Cookie - Clears the `tos` cookie.
401 Error response due to missing auth cookie. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

Verify2FA

Verify2FAResult Verify2FA (TwoFactorAuthCode twoFactorAuthCode)

Verify 2FA code

Finishes the login sequence with a normal 2FA-generated code for accounts with 2FA-protection enabled.

Example

using System.Collections.Generic;
using System.Diagnostics;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

namespace Example
{
    public class Verify2FAExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vrchat.cloud/api/1";
            // Configure API key authorization: authCookie
            config.AddApiKey("auth", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("auth", "Bearer");

            var apiInstance = new AuthenticationApi(config);
            var twoFactorAuthCode = new TwoFactorAuthCode(); // TwoFactorAuthCode | 

            try
            {
                // Verify 2FA code
                Verify2FAResult result = apiInstance.Verify2FA(twoFactorAuthCode);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AuthenticationApi.Verify2FA: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the Verify2FAWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Verify 2FA code
    ApiResponse<Verify2FAResult> response = apiInstance.Verify2FAWithHttpInfo(twoFactorAuthCode);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling AuthenticationApi.Verify2FAWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
twoFactorAuthCode TwoFactorAuthCode

Return type

Verify2FAResult

Authorization

authCookie

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK * Set-Cookie - Provides a `twoFactorAuth` cookie, which can be used to bypasses the 2FA requirement for future logins on the same device.
401 Error response due to missing auth cookie. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

Verify2FAEmailCode

Verify2FAEmailCodeResult Verify2FAEmailCode (TwoFactorEmailCode twoFactorEmailCode)

Verify 2FA email code

Finishes the login sequence with an 2FA email code.

Example

using System.Collections.Generic;
using System.Diagnostics;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

namespace Example
{
    public class Verify2FAEmailCodeExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vrchat.cloud/api/1";
            // Configure API key authorization: authCookie
            config.AddApiKey("auth", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("auth", "Bearer");

            var apiInstance = new AuthenticationApi(config);
            var twoFactorEmailCode = new TwoFactorEmailCode(); // TwoFactorEmailCode | 

            try
            {
                // Verify 2FA email code
                Verify2FAEmailCodeResult result = apiInstance.Verify2FAEmailCode(twoFactorEmailCode);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AuthenticationApi.Verify2FAEmailCode: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the Verify2FAEmailCodeWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Verify 2FA email code
    ApiResponse<Verify2FAEmailCodeResult> response = apiInstance.Verify2FAEmailCodeWithHttpInfo(twoFactorEmailCode);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling AuthenticationApi.Verify2FAEmailCodeWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
twoFactorEmailCode TwoFactorEmailCode

Return type

Verify2FAEmailCodeResult

Authorization

authCookie

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK * Set-Cookie - Provides a `twoFactorAuth` cookie, which can be used to bypasses the 2FA requirement for future logins on the same device.
401 Error response due to missing auth cookie. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

VerifyAuthToken

VerifyAuthTokenResult VerifyAuthToken ()

Verify Auth Token

Verify whether the currently provided Auth Token is valid.

Example

using System.Collections.Generic;
using System.Diagnostics;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

namespace Example
{
    public class VerifyAuthTokenExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vrchat.cloud/api/1";
            // Configure API key authorization: authCookie
            config.AddApiKey("auth", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("auth", "Bearer");

            var apiInstance = new AuthenticationApi(config);

            try
            {
                // Verify Auth Token
                VerifyAuthTokenResult result = apiInstance.VerifyAuthToken();
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AuthenticationApi.VerifyAuthToken: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the VerifyAuthTokenWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Verify Auth Token
    ApiResponse<VerifyAuthTokenResult> response = apiInstance.VerifyAuthTokenWithHttpInfo();
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling AuthenticationApi.VerifyAuthTokenWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

This endpoint does not need any parameter.

Return type

VerifyAuthTokenResult

Authorization

authCookie

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Returns wether a provided auth token is valid or not. -
401 Error response due to missing auth cookie. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

VerifyRecoveryCode

Verify2FAResult VerifyRecoveryCode (TwoFactorAuthCode twoFactorAuthCode)

Verify 2FA code with Recovery code

Finishes the login sequence with an OTP (One Time Password) recovery code for accounts with 2FA-protection enabled.

Example

using System.Collections.Generic;
using System.Diagnostics;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;

namespace Example
{
    public class VerifyRecoveryCodeExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.vrchat.cloud/api/1";
            // Configure API key authorization: authCookie
            config.AddApiKey("auth", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("auth", "Bearer");

            var apiInstance = new AuthenticationApi(config);
            var twoFactorAuthCode = new TwoFactorAuthCode(); // TwoFactorAuthCode | 

            try
            {
                // Verify 2FA code with Recovery code
                Verify2FAResult result = apiInstance.VerifyRecoveryCode(twoFactorAuthCode);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AuthenticationApi.VerifyRecoveryCode: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the VerifyRecoveryCodeWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Verify 2FA code with Recovery code
    ApiResponse<Verify2FAResult> response = apiInstance.VerifyRecoveryCodeWithHttpInfo(twoFactorAuthCode);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling AuthenticationApi.VerifyRecoveryCodeWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
twoFactorAuthCode TwoFactorAuthCode

Return type

Verify2FAResult

Authorization

authCookie

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK * Set-Cookie - Provides a `twoFactorAuth` cookie, which can be used to bypasses the 2FA requirement for future logins on the same device.
401 Error response due to missing auth cookie. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]