VRChat.Authentication (vrchat v1.20.0)

View Source

API calls for all endpoints tagged Authentication.

Summary

Functions

Cancel pending enabling of time-based 2FA codes Cancels the sequence for enabling time-based 2FA.

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.

Confirm Email Confirms the email address for a user

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.

Disable 2FA Disables 2FA for the currently logged in account

Enable time-based 2FA codes Begins the sequence for enabling time-based 2FA.

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.

Get 2FA Recovery codes Gets the OTP (One Time Password) recovery codes for accounts with 2FA-protection enabled.

Logout Invalidates the login session.

Register User Account Register a new user account. DEPRECATED: Automated creation of accounts has no legitimate public third-party use case, and would be in violation of ToS §13.2: By using the Platform, you agree not to: i. [...] use the Platform in a manner inconsistent with individual human usage This endpoint is documented in the interest of completeness

Resend Email Confirmation Requests a resend of pending email address confirmation email

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

Verify 2FA email code Finishes the login sequence with an 2FA email code.

Verify Auth Token Verify whether the currently provided Auth Token is valid.

Verify Login Place Verifies a login attempt for a user

Verify Pending 2FA code Finishes sequence for enabling time-based 2FA.

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

Functions

cancel_pending2_fa(connection, opts \\ [])

@spec cancel_pending2_fa(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, VRChat.Model.Disable2FaResult.t()}
  | {:ok, VRChat.Model.Error.t()}
  | {:error, Tesla.Env.t()}

Cancel pending enabling of time-based 2FA codes Cancels the sequence for enabling time-based 2FA.

Parameters

  • connection (VRChat.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, VRChat.Model.Disable2FaResult.t} on success
  • {:error, Tesla.Env.t} on failure

check_user_exists(connection, opts \\ [])

@spec check_user_exists(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, VRChat.Model.UserExists.t()}
  | {:ok, VRChat.Model.Error.t()}
  | {:error, Tesla.Env.t()}

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.

Parameters

  • connection (VRChat.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :email (String.t): Filter by email.
    • :displayName (String.t): Filter by displayName.
    • :username (String.t): Filter by Username.
    • :excludeUserId (String.t): Exclude by UserID.

Returns

  • {:ok, VRChat.Model.UserExists.t} on success
  • {:error, Tesla.Env.t} on failure

confirm_email(connection, id, verify_email, opts \\ [])

@spec confirm_email(Tesla.Env.client(), String.t(), String.t(), keyword()) ::
  {:ok, nil} | {:error, Tesla.Env.t()}

Confirm Email Confirms the email address for a user

Parameters

  • connection (VRChat.Connection): Connection to server
  • id (String.t): Target user for which to verify email.
  • verify_email (String.t): Token to verify email.
  • opts (keyword): Optional parameters

Returns

  • {:ok, nil} on success
  • {:error, Tesla.Env.t} on failure

delete_user(connection, user_id, opts \\ [])

@spec delete_user(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, VRChat.Model.CurrentUser.t()}
  | {:ok, VRChat.Model.Error.t()}
  | {:error, Tesla.Env.t()}

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.

Parameters

  • connection (VRChat.Connection): Connection to server
  • user_id (String.t): Must be a valid user ID.
  • opts (keyword): Optional parameters

Returns

  • {:ok, VRChat.Model.CurrentUser.t} on success
  • {:error, Tesla.Env.t} on failure

disable2_fa(connection, opts \\ [])

@spec disable2_fa(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, VRChat.Model.Disable2FaResult.t()}
  | {:ok, VRChat.Model.Error.t()}
  | {:error, Tesla.Env.t()}

Disable 2FA Disables 2FA for the currently logged in account

Parameters

  • connection (VRChat.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, VRChat.Model.Disable2FaResult.t} on success
  • {:error, Tesla.Env.t} on failure

enable2_fa(connection, opts \\ [])

@spec enable2_fa(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, VRChat.Model.Pending2FaResult.t()}
  | {:ok, VRChat.Model.Error.t()}
  | {:error, Tesla.Env.t()}

Enable time-based 2FA codes Begins the sequence for enabling time-based 2FA.

Parameters

  • connection (VRChat.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, VRChat.Model.Pending2FaResult.t} on success
  • {:error, Tesla.Env.t} on failure

get_current_user(connection, opts \\ [])

@spec get_current_user(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Tesla.Env.client(), VRChat.Model.CurrentUser.t()}
  | {:ok, VRChat.Model.Error.t()}
  | {:error, Tesla.Env.t()}

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.

Parameters

  • connection (VRChat.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, VRChat.Model.CurrentUser.t} on success
  • {:error, Tesla.Env.t} on failure

get_recovery_codes(connection, opts \\ [])

@spec get_recovery_codes(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, VRChat.Model.Error.t()}
  | {:ok, VRChat.Model.TwoFactorRecoveryCodes.t()}
  | {:error, Tesla.Env.t()}

Get 2FA Recovery codes Gets the OTP (One Time Password) recovery codes for accounts with 2FA-protection enabled.

Parameters

  • connection (VRChat.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, VRChat.Model.TwoFactorRecoveryCodes.t} on success
  • {:error, Tesla.Env.t} on failure

login(options)

logout(connection, opts \\ [])

@spec logout(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, VRChat.Model.Success.t()}
  | {:ok, VRChat.Model.Error.t()}
  | {:error, Tesla.Env.t()}

Logout Invalidates the login session.

Parameters

  • connection (VRChat.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, VRChat.Model.Success.t} on success
  • {:error, Tesla.Env.t} on failure

register_user_account(connection, register_user_account_request, opts \\ [])

@spec register_user_account(
  Tesla.Env.client(),
  VRChat.Model.RegisterUserAccountRequest.t(),
  keyword()
) ::
  {:ok, VRChat.Model.CurrentUser.t()}
  | {:ok, VRChat.Model.Error.t()}
  | {:error, Tesla.Env.t()}

Register User Account Register a new user account. DEPRECATED: Automated creation of accounts has no legitimate public third-party use case, and would be in violation of ToS §13.2: By using the Platform, you agree not to: i. [...] use the Platform in a manner inconsistent with individual human usage This endpoint is documented in the interest of completeness

Parameters

  • connection (VRChat.Connection): Connection to server
  • register_user_account_request (RegisterUserAccountRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, VRChat.Model.CurrentUser.t} on success
  • {:error, Tesla.Env.t} on failure

resend_email_confirmation(connection, opts \\ [])

@spec resend_email_confirmation(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, VRChat.Model.Success.t()}
  | {:ok, VRChat.Model.Error.t()}
  | {:error, Tesla.Env.t()}

Resend Email Confirmation Requests a resend of pending email address confirmation email

Parameters

  • connection (VRChat.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, VRChat.Model.Success.t} on success
  • {:error, Tesla.Env.t} on failure

verify2_fa(connection, two_factor_auth_code, opts \\ [])

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

Parameters

  • connection (VRChat.Connection): Connection to server
  • two_factor_auth_code (TwoFactorAuthCode):
  • opts (keyword): Optional parameters

Returns

  • {:ok, VRChat.Model.Verify2FaResult.t} on success
  • {:error, Tesla.Env.t} on failure

verify2_fa_email_code(connection, two_factor_email_code, opts \\ [])

Verify 2FA email code Finishes the login sequence with an 2FA email code.

Parameters

  • connection (VRChat.Connection): Connection to server
  • two_factor_email_code (TwoFactorEmailCode):
  • opts (keyword): Optional parameters

Returns

  • {:ok, VRChat.Model.Verify2FaEmailCodeResult.t} on success
  • {:error, Tesla.Env.t} on failure

verify_auth_token(connection, opts \\ [])

@spec verify_auth_token(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, VRChat.Model.VerifyAuthTokenResult.t()}
  | {:ok, VRChat.Model.Error.t()}
  | {:error, Tesla.Env.t()}

Verify Auth Token Verify whether the currently provided Auth Token is valid.

Parameters

  • connection (VRChat.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, VRChat.Model.VerifyAuthTokenResult.t} on success
  • {:error, Tesla.Env.t} on failure

verify_login_place(connection, token, opts \\ [])

@spec verify_login_place(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, nil} | {:error, Tesla.Env.t()}

Verify Login Place Verifies a login attempt for a user

Parameters

  • connection (VRChat.Connection): Connection to server
  • token (String.t): Token to verify login attempt.
  • opts (keyword): Optional parameters
    • :userId (String.t): Filter by UserID.

Returns

  • {:ok, nil} on success
  • {:error, Tesla.Env.t} on failure

verify_pending2_fa(connection, two_factor_auth_code, opts \\ [])

@spec verify_pending2_fa(
  Tesla.Env.client(),
  VRChat.Model.TwoFactorAuthCode.t(),
  keyword()
) ::
  {:ok, VRChat.Model.Verify2FaResult.t()}
  | {:ok, VRChat.Model.Error.t()}
  | {:error, Tesla.Env.t()}

Verify Pending 2FA code Finishes sequence for enabling time-based 2FA.

Parameters

  • connection (VRChat.Connection): Connection to server
  • two_factor_auth_code (TwoFactorAuthCode):
  • opts (keyword): Optional parameters

Returns

  • {:ok, VRChat.Model.Verify2FaResult.t} on success
  • {:error, Tesla.Env.t} on failure

verify_recovery_code(connection, two_factor_auth_code, opts \\ [])

@spec verify_recovery_code(
  Tesla.Env.client(),
  VRChat.Model.TwoFactorAuthCode.t(),
  keyword()
) ::
  {:ok, VRChat.Model.Verify2FaResult.t()}
  | {:ok, VRChat.Model.Error.t()}
  | {:error, Tesla.Env.t()}

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

Parameters

  • connection (VRChat.Connection): Connection to server
  • two_factor_auth_code (TwoFactorAuthCode):
  • opts (keyword): Optional parameters

Returns

  • {:ok, VRChat.Model.Verify2FaResult.t} on success
  • {:error, Tesla.Env.t} on failure