Class: Appwrite::Account
- Defined in:
- lib/appwrite/services/account.rb
Instance Method Summary collapse
-
#create(user_id:, email:, password:, name: nil) ⇒ User
Use this endpoint to allow a new user to register a new account in your project.
-
#create_anonymous_session ⇒ Session
Use this endpoint to allow a new user to register an anonymous account in your project.
-
#create_device ⇒ Device
Create an account switching device.
-
#create_email_password_session(email:, password:, duration: nil) ⇒ Session
Allow the user to login into their account by providing a valid email and password combination.
-
#create_email_token(user_id:, email:, phrase: nil) ⇒ Token
Sends the user an email with a secret key for creating a session.
-
#create_email_verification(url:) ⇒ Token
Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address.
-
#create_email_verification_otp(phrase: nil) ⇒ Token
Use this endpoint to send a 6-digit verification code to the currently logged in user's email address.
-
#create_id_token_session(provider:, id_token:, nonce: nil, access_token: nil, access_token_expiry: nil, name: nil) ⇒ Session
Allow the user to login to their account using an OpenID Connect ID token obtained natively from the OAuth2 provider, for example via Google Credential Manager on Android or Sign in with Apple on iOS.
-
#create_ldap_session(username:, password:, duration: nil) ⇒ Session
Allow the user to login into their account by providing the username and password they use in the project's LDAP directory.
-
#create_magic_url_token(user_id:, email:, url: nil, phrase: nil) ⇒ Token
Sends the user an email with a secret key for creating a session.
-
#create_mfa_authenticator(type:) ⇒ MfaType
Add an authenticator app to be used as an MFA factor.
-
#create_mfa_challenge(factor:) ⇒ MfaChallenge
Begin the process of MFA verification after sign-in.
-
#create_mfa_recovery_codes ⇒ MfaRecoveryCodes
Generate recovery codes as backup for MFA flow.
-
#create_o_auth2_token(provider:, success: nil, failure: nil, scopes: nil, state: nil) ⇒ Object
Allow the user to login to their account using the OAuth2 provider of their choice.
-
#create_passkey(passkey_id: nil, name: nil) ⇒ PasskeyChallenge
Start registering a passkey for the currently logged in user.
-
#create_passkey_token ⇒ PasskeyChallenge
Start signing in with a passkey.
-
#create_phone_token(user_id:, phone:) ⇒ Token
Sends the user an SMS with a secret key for creating a session.
-
#create_phone_verification ⇒ Token
Use this endpoint to send a verification SMS to the currently logged in user.
-
#create_recovery(email:, url:) ⇒ Token
Sends the user an email with a temporary secret key for password reset.
-
#create_recovery_otp(email:, phrase: nil) ⇒ Token
Use this endpoint to send a 6-digit password recovery code to the user's email address.
-
#create_session(user_id:, secret:) ⇒ Session
Use this endpoint to create a session from token.
-
#create_verification(url:) ⇒ Token
deprecated
Deprecated.
This API has been deprecated since 1.8.0. Please use
Account.createEmailVerificationinstead. -
#delete_consent(consent_id:) ⇒ Object
Delete an OAuth2 consent by its unique ID.
-
#delete_consent_token(consent_id:, token_id:) ⇒ Object
Delete a token family issued under an OAuth2 consent by its unique ID.
-
#delete_device(device_id:) ⇒ Object
Delete the account switching device for the current browser.
-
#delete_identity(identity_id:) ⇒ Object
Delete an identity by its unique ID.
-
#delete_mfa_authenticator(type:) ⇒ Object
Delete an authenticator for a user by ID.
-
#delete_passkey(passkey_id:) ⇒ Object
Delete a passkey from the currently logged in user.
-
#delete_session(session_id:) ⇒ Object
Logout the user.
-
#delete_sessions(current: nil) ⇒ Object
Delete all sessions from the user account and remove any sessions cookies from the end client.
-
#get ⇒ User
Get the currently logged in user.
-
#get_consent(consent_id:) ⇒ Oauth2Consent
Get an OAuth2 consent the current user has given to a third-party app by its unique ID.
-
#get_consent_token(consent_id:, token_id:) ⇒ Oauth2ConsentToken
Get a token family issued under an OAuth2 consent by its unique ID.
-
#get_device(device_id:) ⇒ Device
Get the account switching device for the current browser, including every session it holds, the name of the user each session belongs to, and the ID of the active session.
-
#get_mfa_recovery_codes ⇒ MfaRecoveryCodes
Get recovery codes that can be used as backup for MFA flow.
-
#get_passkey(passkey_id:) ⇒ Passkey
Get a verified passkey of the currently logged in user by its unique ID.
-
#get_prefs ⇒ Preferences
Get the preferences as a key-value object for the currently logged in user.
-
#get_session(session_id:) ⇒ Session
Use this endpoint to get a logged in user's session using a Session ID.
-
#initialize(client) ⇒ Account
constructor
A new instance of Account.
-
#list_consent_tokens(consent_id:, queries: nil, total: nil) ⇒ Oauth2ConsentTokenList
Get a list of the token families issued under an OAuth2 consent.
-
#list_consents(queries: nil, total: nil) ⇒ Oauth2ConsentList
Get a list of the OAuth2 consents the current user has given to third-party apps.
-
#list_identities(queries: nil, total: nil) ⇒ IdentityList
Get the list of identities for the currently logged in user.
-
#list_memberships(queries: nil, total: nil) ⇒ MembershipList
Get the team memberships of the currently logged in user.
-
#list_mfa_factors ⇒ MfaFactors
List the factors available on the account to be used as a MFA challange.
-
#list_passkeys(queries: nil, total: nil) ⇒ PasskeyList
Get the list of verified passkeys registered by the currently logged in user.
-
#list_sessions(total: nil) ⇒ SessionList
Get the list of active sessions across different devices for the currently logged in user.
-
#update_device_session(device_id:, session_id:) ⇒ Session
Switch the active account on an account switching device to one of the sessions it holds.
-
#update_email(email:, password:) ⇒ User
Update currently logged in user account email address.
-
#update_email_verification(user_id:, secret:) ⇒ Token
Use this endpoint to complete the user email verification process.
-
#update_email_verification_otp(user_id:, secret:) ⇒ Token
Use this endpoint to complete the user email verification process using the 6-digit code that was emailed by createEmailVerificationOTP.
-
#update_magic_url_session(user_id:, secret:) ⇒ Session
deprecated
Deprecated.
This API has been deprecated since 1.6.0. Please use
Account.createSessioninstead. -
#update_mfa(mfa:) ⇒ User
Enable or disable MFA on an account.
-
#update_mfa_authenticator(type:, otp:) ⇒ User
Verify an authenticator app after adding it using the add authenticator method.
-
#update_mfa_challenge(challenge_id:, otp:) ⇒ Session
Complete the MFA challenge by providing the one-time password.
-
#update_mfa_recovery_codes ⇒ MfaRecoveryCodes
Regenerate recovery codes that can be used as backup for MFA flow.
-
#update_name(name:) ⇒ User
Update currently logged in user account name.
-
#update_passkey(passkey_id:, name:) ⇒ Passkey
Rename a passkey of the currently logged in user.
-
#update_passkey_token(challenge_id:, credential:) ⇒ TokenSecret
Complete a passkey sign-in started with Create passkey token.
-
#update_passkey_verification(passkey_id:, credential:) ⇒ Passkey
Complete a passkey registration started with Create passkey.
-
#update_password(password:, old_password: nil) ⇒ User
Update currently logged in user password.
-
#update_phone(phone:, password:) ⇒ User
Update the currently logged in user's phone number.
-
#update_phone_session(user_id:, secret:) ⇒ Session
deprecated
Deprecated.
This API has been deprecated since 1.6.0. Please use
Account.createSessioninstead. -
#update_phone_verification(user_id:, secret:) ⇒ Token
Use this endpoint to complete the user phone verification process.
-
#update_prefs(prefs:) ⇒ User
Update currently logged in user account preferences.
-
#update_recovery(user_id:, secret:, password:) ⇒ Token
Use this endpoint to complete the user account password reset.
-
#update_recovery_otp(user_id:, secret:, password:) ⇒ Token
Use this endpoint to complete the user password recovery process using the 6-digit code that was emailed by createRecoveryOTP.
-
#update_session(session_id:) ⇒ Session
Use this endpoint to extend a session's length.
-
#update_status ⇒ User
Block the currently logged in user account.
-
#update_verification(user_id:, secret:) ⇒ Token
deprecated
Deprecated.
This API has been deprecated since 1.8.0. Please use
Account.updateEmailVerificationinstead.
Constructor Details
#initialize(client) ⇒ Account
Returns a new instance of Account.
5 6 7 |
# File 'lib/appwrite/services/account.rb', line 5 def initialize(client) @client = client end |
Instance Method Details
#create(user_id:, email:, password:, name: nil) ⇒ User
Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the /account/verfication route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new account session.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/appwrite/services/account.rb', line 46 def create( user_id:, email:, password:, name: nil ) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? raise Appwrite::Exception.new('Missing required parameter: "password"') end api_path = '/account' api_params = { userId: user_id, email: email, password: password, name: name, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::User ) end |
#create_anonymous_session ⇒ Session
Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its email and password or create an OAuth2 session.
1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 |
# File 'lib/appwrite/services/account.rb', line 1607 def create_anonymous_session() api_path = '/account/sessions/anonymous' api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Session ) end |
#create_device ⇒ Device
Create an account switching device. A device is a container, scoped to one browser or app install, that holds multiple sessions and tracks which one is active. Once a device exists, session creation endpoints attach the new session to it automatically, so a single browser can stay signed in to several accounts and switch between them. A device holds at most one session per user: signing in again as a user it already holds replaces that user's session. The device lives as long as its newest session.
The device secret is returned in a cookie. Run this on app start: if the browser already has a valid device, the existing one is returned with the same status code instead of an error, so it is always safe to call.
Every session that joins the device rotates the device secret and re-issues the cookie, so an earlier copy of the secret stops working. A client that keeps the secret itself, rather than relying on the cookie, must replace it from each session response.
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
# File 'lib/appwrite/services/account.rb', line 323 def create_device() api_path = '/account/devices' api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Device ) end |
#create_email_password_session(email:, password:, duration: nil) ⇒ Session
Allow the user to login into their account by providing a valid email and
password combination. This route will create a new session for the user.
Use the optional duration parameter to create a shorter session, for
example when the user doesn't choose "remember me". It must be at least 60
seconds and cannot exceed the project maximum session length.
A user is limited to 10 active sessions at a time by default. Learn more about session limits.
1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 |
# File 'lib/appwrite/services/account.rb', line 1642 def create_email_password_session( email:, password:, duration: nil ) if email.nil? raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? raise Appwrite::Exception.new('Missing required parameter: "password"') end api_path = '/account/sessions/email' api_params = { email: email, password: password, duration: duration, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Session ) end |
#create_email_token(user_id:, email:, phrase: nil) ⇒ Token
Sends the user an email with a secret key for creating a session. If the
email address has never been used, a new account is created using the
provided userId. Otherwise, if the email address is already attached to
an account, the user ID is ignored. Then, the user will receive an
email with the one-time password. Use the returned user ID and secret and
submit a request to the POST
/v1/account/sessions/token
endpoint to complete the login process. The secret sent to the user's email
is valid for 15 minutes.
A user is limited to 10 active sessions at a time by default. Learn more about session limits.
2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 |
# File 'lib/appwrite/services/account.rb', line 2100 def create_email_token( user_id:, email:, phrase: nil ) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? raise Appwrite::Exception.new('Missing required parameter: "email"') end api_path = '/account/tokens/email' api_params = { userId: user_id, email: email, phrase: phrase, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Token ) end |
#create_email_verification(url:) ⇒ Token
Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the userId and secret arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the userId and secret parameters. Learn more about how to complete the verification process. The verification link sent to the user's email address is valid for 7 days.
Please note that in order to avoid a Redirect Attack, the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 |
# File 'lib/appwrite/services/account.rb', line 2402 def create_email_verification( url: ) if url.nil? raise Appwrite::Exception.new('Missing required parameter: "url"') end api_path = '/account/verifications/email' api_params = { url: url, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Token ) end |
#create_email_verification_otp(phrase: nil) ⇒ Token
Use this endpoint to send a 6-digit verification code to the currently logged in user's email address. Unlike createEmailVerification, this method requires no redirect URL, which makes it suitable for mobile and desktop apps that cannot host a verification page. Learn more about how to complete the verification process. The code sent to the user's email address is valid for 15 minutes.
Enable the phrase parameter to include a randomly generated security phrase in both the email and the response. Showing that phrase in your app lets the user confirm the email genuinely came from your request, which helps protect against phishing.
2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 |
# File 'lib/appwrite/services/account.rb', line 2587 def create_email_verification_otp( phrase: nil ) api_path = '/account/verifications/email/otp' api_params = { phrase: phrase, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Token ) end |
#create_id_token_session(provider:, id_token:, nonce: nil, access_token: nil, access_token_expiry: nil, name: nil) ⇒ Session
Allow the user to login to their account using an OpenID Connect ID token obtained natively from the OAuth2 provider, for example via Google Credential Manager on Android or Sign in with Apple on iOS. No browser or redirect is involved: the ID token is verified against the provider's published signing keys and a session is created in a single request.
Native sign-in is switched on per provider with its nativeEnabled setting. It is independent of the browser-based flow's enabled setting, which has no effect on this endpoint. The token's audience must match the provider's configured client ID or one of its native client IDs; tokens issued for any other client ID are rejected. For Sign in with Apple, register your app's bundle ID as a native client ID. For Google, the web client ID used by Credential Manager is usually the configured client ID; add your Android and iOS client IDs as native client IDs if your app requests tokens for them.
Pass the raw nonce used when requesting the ID token so it can be validated against the token's nonce claim. When signing in with Apple, the nonce is required: hash it with SHA-256 before passing it to the Apple SDK, and send the raw value here - Apple tokens requested without a nonce are rejected. For Google the nonce is optional: it is validated whenever the token carries one, and ignored when the provider issued the token without one. Apple only returns the user's name on the first authorization, and never inside the ID token - capture it on the client and pass it via the name parameter.
If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the verified email received from the provider and attach the new session to the existing user. If no matching user is found - the server will create a new user.
This flow does not return provider refresh tokens. You may pass an access token the provider handed your client, along with its lifetime, to store it on the session - but Appwrite cannot renew it once it expires. If your app needs long-lived access to provider APIs, use the browser-based OAuth2 flow instead.
A user is limited to 10 active sessions at a time by default. Learn more about session limits.
1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 |
# File 'lib/appwrite/services/account.rb', line 1729 def create_id_token_session( provider:, id_token:, nonce: nil, access_token: nil, access_token_expiry: nil, name: nil ) if provider.nil? raise Appwrite::Exception.new('Missing required parameter: "provider"') end if id_token.nil? raise Appwrite::Exception.new('Missing required parameter: "idToken"') end api_path = '/account/sessions/id-token' api_params = { provider: provider, idToken: id_token, nonce: nonce, accessToken: access_token, accessTokenExpiry: access_token_expiry, name: name, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Session ) end |
#create_ldap_session(username:, password:, duration: nil) ⇒ Session
Allow the user to login into their account by providing the username and password they use in the project's LDAP directory. The directory verifies the password; on the first sign-in an account is created from the directory entry, and on later sign-ins the name, email and phone follow the directory. This endpoint requires LDAP to be configured and enabled for the project. A user is limited to 10 active sessions at a time by default. Learn more about session limits.
1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 |
# File 'lib/appwrite/services/account.rb', line 1785 def create_ldap_session( username:, password:, duration: nil ) if username.nil? raise Appwrite::Exception.new('Missing required parameter: "username"') end if password.nil? raise Appwrite::Exception.new('Missing required parameter: "password"') end api_path = '/account/sessions/ldap' api_params = { username: username, password: password, duration: duration, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Session ) end |
#create_magic_url_token(user_id:, email:, url: nil, phrase: nil) ⇒ Token
Sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the POST /v1/account/sessions/token endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour.
A user is limited to 10 active sessions at a time by default. Learn more about session limits.
2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 |
# File 'lib/appwrite/services/account.rb', line 2157 def create_magic_url_token( user_id:, email:, url: nil, phrase: nil ) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if email.nil? raise Appwrite::Exception.new('Missing required parameter: "email"') end api_path = '/account/tokens/magic-url' api_params = { userId: user_id, email: email, url: url, phrase: phrase, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Token ) end |
#create_mfa_authenticator(type:) ⇒ MfaType
Add an authenticator app to be used as an MFA factor. Verify the authenticator using the verify authenticator method.
640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 |
# File 'lib/appwrite/services/account.rb', line 640 def create_mfa_authenticator( type: ) if type.nil? raise Appwrite::Exception.new('Missing required parameter: "type"') end api_path = '/account/mfa/authenticators/{type}' .gsub('{type}', @client.encode_path(type)) api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::MfaType ) end |
#create_mfa_challenge(factor:) ⇒ MfaChallenge
Begin the process of MFA verification after sign-in. Finish the flow with updateMfaChallenge method.
747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 |
# File 'lib/appwrite/services/account.rb', line 747 def create_mfa_challenge( factor: ) if factor.nil? raise Appwrite::Exception.new('Missing required parameter: "factor"') end api_path = '/account/mfa/challenges' api_params = { factor: factor, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::MfaChallenge ) end |
#create_mfa_recovery_codes ⇒ MfaRecoveryCodes
Generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in createMfaChallenge method.
876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 |
# File 'lib/appwrite/services/account.rb', line 876 def create_mfa_recovery_codes() api_path = '/account/mfa/recovery-codes' api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::MfaRecoveryCodes ) end |
#create_o_auth2_token(provider:, success: nil, failure: nil, scopes: nil, state: nil) ⇒ Object
Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
If authentication succeeds, userId and secret of a token will be
appended to the success URL as query parameters. These can be used to
create a new session using the Create
session
endpoint.
If there is already an active session, the OAuth2 identity is attached to the logged-in account and that session stays active until the token is exchanged for a new one.
A user is limited to 10 active sessions at a time by default. Learn more about session limits.
2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 |
# File 'lib/appwrite/services/account.rb', line 2221 def create_o_auth2_token( provider:, success: nil, failure: nil, scopes: nil, state: nil ) if provider.nil? raise Appwrite::Exception.new('Missing required parameter: "provider"') end api_path = '/account/tokens/oauth2/{provider}' .gsub('{provider}', @client.encode_path(provider)) api_params = { success: success, failure: failure, scopes: scopes, state: state, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'text/html', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: "location" ) end |
#create_passkey(passkey_id: nil, name: nil) ⇒ PasskeyChallenge
Start registering a passkey for the currently logged in user. The session
must have signed in or completed an MFA challenge within the last 10
minutes. Pass the returned publicKey options to
navigator.credentials.create(), then complete the registration with
Update passkey
verification.
The passkey stays pending until verified, and the challenge expires after 5
minutes.
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 |
# File 'lib/appwrite/services/account.rb', line 1001 def create_passkey( passkey_id: nil, name: nil ) api_path = '/account/passkeys' api_params = { passkeyId: passkey_id, name: name, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::PasskeyChallenge ) end |
#create_passkey_token ⇒ PasskeyChallenge
Start signing in with a passkey. No email or user ID is needed: pass the
returned publicKey options to navigator.credentials.get() and the user
picks one of their passkeys. Then call Update passkey
token with
the credential to receive a token, and exchange it with Create
session. The
challenge expires after 5 minutes.
2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 |
# File 'lib/appwrite/services/account.rb', line 2266 def create_passkey_token() api_path = '/account/tokens/passkey' api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::PasskeyChallenge ) end |
#create_phone_token(user_id:, phone:) ⇒ Token
Sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the POST /v1/account/sessions/token endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes.
A user is limited to 10 active sessions at a time by default. Learn more about session limits.
2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 |
# File 'lib/appwrite/services/account.rb', line 2349 def create_phone_token( user_id:, phone: ) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if phone.nil? raise Appwrite::Exception.new('Missing required parameter: "phone"') end api_path = '/account/tokens/phone' api_params = { userId: user_id, phone: phone, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Token ) end |
#create_phone_verification ⇒ Token
Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the accountUpdatePhone endpoint. Learn more about how to complete the verification process. The verification code sent to the user's phone number is valid for 15 minutes.
2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 |
# File 'lib/appwrite/services/account.rb', line 2668 def create_phone_verification() api_path = '/account/verifications/phone' api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Token ) end |
#create_recovery(email:, url:) ⇒ Token
Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the PUT /account/recovery endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.
1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 |
# File 'lib/appwrite/services/account.rb', line 1329 def create_recovery( email:, url: ) if email.nil? raise Appwrite::Exception.new('Missing required parameter: "email"') end if url.nil? raise Appwrite::Exception.new('Missing required parameter: "url"') end api_path = '/account/recovery' api_params = { email: email, url: url, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Token ) end |
#create_recovery_otp(email:, phrase: nil) ⇒ Token
Use this endpoint to send a 6-digit password recovery code to the user's email address. Unlike createRecovery, this method requires no redirect URL, which makes it suitable for mobile and desktop apps that cannot host a recovery page. Learn more about how to complete the recovery process. The code sent to the user's email address is valid for 15 minutes.
Enable the phrase parameter to include a randomly generated security phrase in both the email and the response. Showing that phrase in your app lets the user confirm the email genuinely came from your request, which helps protect against phishing.
1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 |
# File 'lib/appwrite/services/account.rb', line 1447 def create_recovery_otp( email:, phrase: nil ) if email.nil? raise Appwrite::Exception.new('Missing required parameter: "email"') end api_path = '/account/recovery/otp' api_params = { email: email, phrase: phrase, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Token ) end |
#create_session(user_id:, secret:) ⇒ Session
Use this endpoint to create a session from token. Provide the userId and secret parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 |
# File 'lib/appwrite/services/account.rb', line 1919 def create_session( user_id:, secret: ) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_path = '/account/sessions/token' api_params = { userId: user_id, secret: secret, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Session ) end |
#create_verification(url:) ⇒ Token
This API has been deprecated since 1.8.0. Please use Account.createEmailVerification instead.
Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the userId and secret arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the userId and secret parameters. Learn more about how to complete the verification process. The verification link sent to the user's email address is valid for 7 days.
Please note that in order to avoid a Redirect Attack, the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 |
# File 'lib/appwrite/services/account.rb', line 2452 def create_verification( url: ) if url.nil? raise Appwrite::Exception.new('Missing required parameter: "url"') end api_path = '/account/verifications/email' api_params = { url: url, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'POST', path: api_path, headers: api_headers, params: api_params, response_type: Models::Token ) end |
#delete_consent(consent_id:) ⇒ Object
Delete an OAuth2 consent by its unique ID. All token families issued under the consent are revoked, and the app must ask for consent again to regain access.
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/appwrite/services/account.rb', line 159 def ( consent_id: ) if .nil? || == '' raise Appwrite::Exception.new('Missing required parameter: "consentId"') end api_path = '/account/consents/{consentId}' .gsub('{consentId}', @client.encode_path()) api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#delete_consent_token(consent_id:, token_id:) ⇒ Object
Delete a token family issued under an OAuth2 consent by its unique ID. The access and refresh tokens of the family stop working immediately; other token families and the consent itself are unaffected.
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/appwrite/services/account.rb', line 272 def ( consent_id:, token_id: ) if .nil? || == '' raise Appwrite::Exception.new('Missing required parameter: "consentId"') end if token_id.nil? || token_id == '' raise Appwrite::Exception.new('Missing required parameter: "tokenId"') end api_path = '/account/consents/{consentId}/tokens/{tokenId}' .gsub('{consentId}', @client.encode_path()) .gsub('{tokenId}', @client.encode_path(token_id)) api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#delete_device(device_id:) ⇒ Object
Delete the account switching device for the current browser. Every session the device holds is signed out, each firing its own session delete event, the device is removed, and both the device and session cookies are cleared. Use the string 'current' to reference the current browser's device.
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 |
# File 'lib/appwrite/services/account.rb', line 385 def delete_device( device_id: ) if device_id.nil? || device_id == '' raise Appwrite::Exception.new('Missing required parameter: "deviceId"') end api_path = '/account/devices/{deviceId}' .gsub('{deviceId}', @client.encode_path(device_id)) api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#delete_identity(identity_id:) ⇒ Object
Delete an identity by its unique ID.
542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 |
# File 'lib/appwrite/services/account.rb', line 542 def delete_identity( identity_id: ) if identity_id.nil? || identity_id == '' raise Appwrite::Exception.new('Missing required parameter: "identityId"') end api_path = '/account/identities/{identityId}' .gsub('{identityId}', @client.encode_path(identity_id)) api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#delete_mfa_authenticator(type:) ⇒ Object
Delete an authenticator for a user by ID.
714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 |
# File 'lib/appwrite/services/account.rb', line 714 def delete_mfa_authenticator( type: ) if type.nil? raise Appwrite::Exception.new('Missing required parameter: "type"') end api_path = '/account/mfa/authenticators/{type}' .gsub('{type}', @client.encode_path(type)) api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#delete_passkey(passkey_id:) ⇒ Object
Delete a passkey from the currently logged in user. The passkey can no longer be used to sign in, although it may remain stored on the user's device. The session must have signed in or completed an MFA challenge within the last 10 minutes.
1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 |
# File 'lib/appwrite/services/account.rb', line 1106 def delete_passkey( passkey_id: ) if passkey_id.nil? || passkey_id == '' raise Appwrite::Exception.new('Missing required parameter: "passkeyId"') end api_path = '/account/passkeys/{passkeyId}' .gsub('{passkeyId}', @client.encode_path(passkey_id)) api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#delete_session(session_id:) ⇒ Object
Logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use Delete Sessions instead.
2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 |
# File 'lib/appwrite/services/account.rb', line 2028 def delete_session( session_id: ) if session_id.nil? || session_id == '' raise Appwrite::Exception.new('Missing required parameter: "sessionId"') end api_path = '/account/sessions/{sessionId}' .gsub('{sessionId}', @client.encode_path(session_id)) api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#delete_sessions(current: nil) ⇒ Object
Delete all sessions from the user account and remove any sessions cookies
from the end client. Pass current as false to keep the session making the
request and sign out of every other session.
1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 |
# File 'lib/appwrite/services/account.rb', line 1574 def delete_sessions( current: nil ) api_path = '/account/sessions' api_params = { current: current, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'DELETE', path: api_path, headers: api_headers, params: api_params, ) end |
#get ⇒ User
Get the currently logged in user.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/appwrite/services/account.rb', line 13 def get() api_path = '/account' api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::User ) end |
#get_consent(consent_id:) ⇒ Oauth2Consent
Get an OAuth2 consent the current user has given to a third-party app by its unique ID.
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/appwrite/services/account.rb', line 126 def ( consent_id: ) if .nil? || == '' raise Appwrite::Exception.new('Missing required parameter: "consentId"') end api_path = '/account/consents/{consentId}' .gsub('{consentId}', @client.encode_path()) api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::Oauth2Consent ) end |
#get_consent_token(consent_id:, token_id:) ⇒ Oauth2ConsentToken
Get a token family issued under an OAuth2 consent by its unique ID. The token secrets themselves are never returned.
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/appwrite/services/account.rb', line 232 def ( consent_id:, token_id: ) if .nil? || == '' raise Appwrite::Exception.new('Missing required parameter: "consentId"') end if token_id.nil? || token_id == '' raise Appwrite::Exception.new('Missing required parameter: "tokenId"') end api_path = '/account/consents/{consentId}/tokens/{tokenId}' .gsub('{consentId}', @client.encode_path()) .gsub('{tokenId}', @client.encode_path(token_id)) api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::Oauth2ConsentToken ) end |
#get_device(device_id:) ⇒ Device
Get the account switching device for the current browser, including every session it holds, the name of the user each session belongs to, and the ID of the active session. Use the string 'current' to reference the current browser's device.
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'lib/appwrite/services/account.rb', line 351 def get_device( device_id: ) if device_id.nil? || device_id == '' raise Appwrite::Exception.new('Missing required parameter: "deviceId"') end api_path = '/account/devices/{deviceId}' .gsub('{deviceId}', @client.encode_path(device_id)) api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::Device ) end |
#get_mfa_recovery_codes ⇒ MfaRecoveryCodes
Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using createMfaRecoveryCodes method. An OTP challenge is required to read recovery codes.
849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 |
# File 'lib/appwrite/services/account.rb', line 849 def get_mfa_recovery_codes() api_path = '/account/mfa/recovery-codes' api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::MfaRecoveryCodes ) end |
#get_passkey(passkey_id:) ⇒ Passkey
Get a verified passkey of the currently logged in user by its unique ID.
1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 |
# File 'lib/appwrite/services/account.rb', line 1032 def get_passkey( passkey_id: ) if passkey_id.nil? || passkey_id == '' raise Appwrite::Exception.new('Missing required parameter: "passkeyId"') end api_path = '/account/passkeys/{passkeyId}' .gsub('{passkeyId}', @client.encode_path(passkey_id)) api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::Passkey ) end |
#get_prefs ⇒ Preferences
Get the preferences as a key-value object for the currently logged in user.
1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 |
# File 'lib/appwrite/services/account.rb', line 1262 def get_prefs() api_path = '/account/prefs' api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::Preferences ) end |
#get_session(session_id:) ⇒ Session
Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.
1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 |
# File 'lib/appwrite/services/account.rb', line 1959 def get_session( session_id: ) if session_id.nil? || session_id == '' raise Appwrite::Exception.new('Missing required parameter: "sessionId"') end api_path = '/account/sessions/{sessionId}' .gsub('{sessionId}', @client.encode_path(session_id)) api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::Session ) end |
#list_consent_tokens(consent_id:, queries: nil, total: nil) ⇒ Oauth2ConsentTokenList
Get a list of the token families issued under an OAuth2 consent. Each entry represents one authorized device or session; the token secrets themselves are never returned.
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/appwrite/services/account.rb', line 194 def ( consent_id:, queries: nil, total: nil ) if .nil? || == '' raise Appwrite::Exception.new('Missing required parameter: "consentId"') end api_path = '/account/consents/{consentId}/tokens' .gsub('{consentId}', @client.encode_path()) api_params = { queries: queries, total: total, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::Oauth2ConsentTokenList ) end |
#list_consents(queries: nil, total: nil) ⇒ Oauth2ConsentList
Get a list of the OAuth2 consents the current user has given to third-party apps.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/appwrite/services/account.rb', line 95 def ( queries: nil, total: nil ) api_path = '/account/consents' api_params = { queries: queries, total: total, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::Oauth2ConsentList ) end |
#list_identities(queries: nil, total: nil) ⇒ IdentityList
Get the list of identities for the currently logged in user.
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 |
# File 'lib/appwrite/services/account.rb', line 512 def list_identities( queries: nil, total: nil ) api_path = '/account/identities' api_params = { queries: queries, total: total, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::IdentityList ) end |
#list_memberships(queries: nil, total: nil) ⇒ MembershipList
Get the team memberships of the currently logged in user.
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 |
# File 'lib/appwrite/services/account.rb', line 574 def list_memberships( queries: nil, total: nil ) api_path = '/account/memberships' api_params = { queries: queries, total: total, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::MembershipList ) end |
#list_mfa_factors ⇒ MfaFactors
List the factors available on the account to be used as a MFA challange.
823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 |
# File 'lib/appwrite/services/account.rb', line 823 def list_mfa_factors() api_path = '/account/mfa/factors' api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::MfaFactors ) end |
#list_passkeys(queries: nil, total: nil) ⇒ PasskeyList
Get the list of verified passkeys registered by the currently logged in user.
963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 |
# File 'lib/appwrite/services/account.rb', line 963 def list_passkeys( queries: nil, total: nil ) api_path = '/account/passkeys' api_params = { queries: queries, total: total, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::PasskeyList ) end |
#list_sessions(total: nil) ⇒ SessionList
Get the list of active sessions across different devices for the currently logged in user.
1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 |
# File 'lib/appwrite/services/account.rb', line 1544 def list_sessions( total: nil ) api_path = '/account/sessions' api_params = { total: total, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "accept": 'application/json', } @client.call( method: 'GET', path: api_path, headers: api_headers, params: api_params, response_type: Models::SessionList ) end |
#update_device_session(device_id:, session_id:) ⇒ Session
Switch the active account on an account switching device to one of the sessions it holds. The chosen session becomes active and its secret is written to the browser's session cookie, so subsequent requests authenticate as that account. Use the string 'current' to reference the current browser's device.
Switching rotates the chosen session's secret. Any other holder of that session, such as a copy kept elsewhere, stops working, so a session should not be shared across devices.
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 |
# File 'lib/appwrite/services/account.rb', line 425 def update_device_session( device_id:, session_id: ) if device_id.nil? || device_id == '' raise Appwrite::Exception.new('Missing required parameter: "deviceId"') end if session_id.nil? raise Appwrite::Exception.new('Missing required parameter: "sessionId"') end api_path = '/account/devices/{deviceId}/session' .gsub('{deviceId}', @client.encode_path(device_id)) api_params = { sessionId: session_id, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::Session ) end |
#update_email(email:, password:) ⇒ User
Update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request. This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 |
# File 'lib/appwrite/services/account.rb', line 472 def update_email( email:, password: ) if email.nil? raise Appwrite::Exception.new('Missing required parameter: "email"') end if password.nil? raise Appwrite::Exception.new('Missing required parameter: "password"') end api_path = '/account/email' api_params = { email: email, password: password, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::User ) end |
#update_email_verification(user_id:, secret:) ⇒ Token
Use this endpoint to complete the user email verification process. Use both the userId and secret parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 |
# File 'lib/appwrite/services/account.rb', line 2489 def update_email_verification( user_id:, secret: ) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_path = '/account/verifications/email' api_params = { userId: user_id, secret: secret, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PUT', path: api_path, headers: api_headers, params: api_params, response_type: Models::Token ) end |
#update_email_verification_otp(user_id:, secret:) ⇒ Token
Use this endpoint to complete the user email verification process using the 6-digit code that was emailed by createEmailVerificationOTP. Pass the userId of the user being verified along with the secret code from the email. If confirmed, this route will return a 200 status code and the code is consumed.
2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 |
# File 'lib/appwrite/services/account.rb', line 2623 def update_email_verification_otp( user_id:, secret: ) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_path = '/account/verifications/email/otp' api_params = { userId: user_id, secret: secret, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PUT', path: api_path, headers: api_headers, params: api_params, response_type: Models::Token ) end |
#update_magic_url_session(user_id:, secret:) ⇒ Session
This API has been deprecated since 1.6.0. Please use Account.createSession instead.
Use this endpoint to create a session from token. Provide the userId and secret parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 |
# File 'lib/appwrite/services/account.rb', line 1832 def update_magic_url_session( user_id:, secret: ) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_path = '/account/sessions/magic-url' api_params = { userId: user_id, secret: secret, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PUT', path: api_path, headers: api_headers, params: api_params, response_type: Models::Session ) end |
#update_mfa(mfa:) ⇒ User
Enable or disable MFA on an account.
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 |
# File 'lib/appwrite/services/account.rb', line 604 def update_mfa( mfa: ) if mfa.nil? raise Appwrite::Exception.new('Missing required parameter: "mfa"') end api_path = '/account/mfa' api_params = { mfa: mfa, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::User ) end |
#update_mfa_authenticator(type:, otp:) ⇒ User
Verify an authenticator app after adding it using the add authenticator method.
675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 |
# File 'lib/appwrite/services/account.rb', line 675 def update_mfa_authenticator( type:, otp: ) if type.nil? raise Appwrite::Exception.new('Missing required parameter: "type"') end if otp.nil? raise Appwrite::Exception.new('Missing required parameter: "otp"') end api_path = '/account/mfa/authenticators/{type}' .gsub('{type}', @client.encode_path(type)) api_params = { otp: otp, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PUT', path: api_path, headers: api_headers, params: api_params, response_type: Models::User ) end |
#update_mfa_challenge(challenge_id:, otp:) ⇒ Session
Complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use createMfaChallenge method.
785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 |
# File 'lib/appwrite/services/account.rb', line 785 def update_mfa_challenge( challenge_id:, otp: ) if challenge_id.nil? raise Appwrite::Exception.new('Missing required parameter: "challengeId"') end if otp.nil? raise Appwrite::Exception.new('Missing required parameter: "otp"') end api_path = '/account/mfa/challenges' api_params = { challengeId: challenge_id, otp: otp, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PUT', path: api_path, headers: api_headers, params: api_params, response_type: Models::Session ) end |
#update_mfa_recovery_codes ⇒ MfaRecoveryCodes
Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using createMfaRecoveryCodes method. An OTP challenge is required to regenreate recovery codes.
903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 |
# File 'lib/appwrite/services/account.rb', line 903 def update_mfa_recovery_codes() api_path = '/account/mfa/recovery-codes' api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::MfaRecoveryCodes ) end |
#update_name(name:) ⇒ User
Update currently logged in user account name.
928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 |
# File 'lib/appwrite/services/account.rb', line 928 def update_name( name: ) if name.nil? raise Appwrite::Exception.new('Missing required parameter: "name"') end api_path = '/account/name' api_params = { name: name, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::User ) end |
#update_passkey(passkey_id:, name:) ⇒ Passkey
Rename a passkey of the currently logged in user.
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 |
# File 'lib/appwrite/services/account.rb', line 1064 def update_passkey( passkey_id:, name: ) if passkey_id.nil? || passkey_id == '' raise Appwrite::Exception.new('Missing required parameter: "passkeyId"') end if name.nil? raise Appwrite::Exception.new('Missing required parameter: "name"') end api_path = '/account/passkeys/{passkeyId}' .gsub('{passkeyId}', @client.encode_path(passkey_id)) api_params = { name: name, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::Passkey ) end |
#update_passkey_token(challenge_id:, credential:) ⇒ TokenSecret
Complete a passkey sign-in started with Create passkey
token. Pass
the challenge ID and the JSON form of the credential returned by
navigator.credentials.get(), for example credential.toJSON(). The
returned token includes its secret and expires after 1 minute: exchange it
for a session with Create
session. Passkeys
require user verification, so the session also satisfies MFA. Each
challenge can only be used once.
2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 |
# File 'lib/appwrite/services/account.rb', line 2300 def update_passkey_token( challenge_id:, credential: ) if challenge_id.nil? raise Appwrite::Exception.new('Missing required parameter: "challengeId"') end if credential.nil? raise Appwrite::Exception.new('Missing required parameter: "credential"') end api_path = '/account/tokens/passkey' api_params = { challengeId: challenge_id, credential: credential, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PUT', path: api_path, headers: api_headers, params: api_params, response_type: Models::TokenSecret ) end |
#update_passkey_verification(passkey_id:, credential:) ⇒ Passkey
Complete a passkey registration started with Create
passkey. Pass the
JSON form of the credential returned by navigator.credentials.create(),
for example credential.toJSON(). Each registration can be verified once;
a failed attempt requires starting it again.
1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 |
# File 'lib/appwrite/services/account.rb', line 1142 def update_passkey_verification( passkey_id:, credential: ) if passkey_id.nil? || passkey_id == '' raise Appwrite::Exception.new('Missing required parameter: "passkeyId"') end if credential.nil? raise Appwrite::Exception.new('Missing required parameter: "credential"') end api_path = '/account/passkeys/{passkeyId}/verification' .gsub('{passkeyId}', @client.encode_path(passkey_id)) api_params = { credential: credential, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PUT', path: api_path, headers: api_headers, params: api_params, response_type: Models::Passkey ) end |
#update_password(password:, old_password: nil) ⇒ User
Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional.
1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 |
# File 'lib/appwrite/services/account.rb', line 1184 def update_password( password:, old_password: nil ) if password.nil? raise Appwrite::Exception.new('Missing required parameter: "password"') end api_path = '/account/password' api_params = { password: password, oldPassword: old_password, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::User ) end |
#update_phone(phone:, password:) ⇒ User
Update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the POST /account/verification/phone endpoint to send a confirmation SMS.
1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 |
# File 'lib/appwrite/services/account.rb', line 1224 def update_phone( phone:, password: ) if phone.nil? raise Appwrite::Exception.new('Missing required parameter: "phone"') end if password.nil? raise Appwrite::Exception.new('Missing required parameter: "password"') end api_path = '/account/phone' api_params = { phone: phone, password: password, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::User ) end |
#update_phone_session(user_id:, secret:) ⇒ Session
This API has been deprecated since 1.6.0. Please use Account.createSession instead.
Use this endpoint to create a session from token. Provide the userId and secret parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 |
# File 'lib/appwrite/services/account.rb', line 1877 def update_phone_session( user_id:, secret: ) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_path = '/account/sessions/phone' api_params = { userId: user_id, secret: secret, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PUT', path: api_path, headers: api_headers, params: api_params, response_type: Models::Session ) end |
#update_phone_verification(user_id:, secret:) ⇒ Token
Use this endpoint to complete the user phone verification process. Use the userId and secret that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code.
2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 |
# File 'lib/appwrite/services/account.rb', line 2697 def update_phone_verification( user_id:, secret: ) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_path = '/account/verifications/phone' api_params = { userId: user_id, secret: secret, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PUT', path: api_path, headers: api_headers, params: api_params, response_type: Models::Token ) end |
#update_prefs(prefs:) ⇒ User
Update currently logged in user account preferences. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.
1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 |
# File 'lib/appwrite/services/account.rb', line 1288 def update_prefs( prefs: ) if prefs.nil? raise Appwrite::Exception.new('Missing required parameter: "prefs"') end api_path = '/account/prefs' api_params = { prefs: prefs, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::User ) end |
#update_recovery(user_id:, secret:, password:) ⇒ Token
Use this endpoint to complete the user account password reset. Both the userId and secret arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the POST /account/recovery endpoint.
Please note that in order to avoid a Redirect Attack the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
The new password must satisfy the project's enabled password policies, including custom deny lists. Dictionary entries match the entire password case-sensitively; personal-data terms match substrings case-insensitively. Personal-data validation runs after token verification against the recovered user's ID, name, email, and phone, closing the previous recovery gap for profile-based checks. A rejected password leaves the existing credentials unchanged and the recovery token usable.
1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 |
# File 'lib/appwrite/services/account.rb', line 1388 def update_recovery( user_id:, secret:, password: ) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? raise Appwrite::Exception.new('Missing required parameter: "secret"') end if password.nil? raise Appwrite::Exception.new('Missing required parameter: "password"') end api_path = '/account/recovery' api_params = { userId: user_id, secret: secret, password: password, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PUT', path: api_path, headers: api_headers, params: api_params, response_type: Models::Token ) end |
#update_recovery_otp(user_id:, secret:, password:) ⇒ Token
Use this endpoint to complete the user password recovery process using the 6-digit code that was emailed by createRecoveryOTP. Pass the userId of the user along with the secret code from the email and the new password to set. If confirmed, this route will return a 200 status code, the code is consumed and the user's password is updated.
The new password must satisfy the project's enabled password policies, including custom deny lists. Dictionary entries match the entire password case-sensitively; personal-data terms match substrings case-insensitively. Personal-data validation runs after token verification against the recovered user's ID, name, email, and phone, closing the previous recovery gap for profile-based checks. A rejected password leaves the existing credentials unchanged and the recovery token usable.
1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 |
# File 'lib/appwrite/services/account.rb', line 1498 def update_recovery_otp( user_id:, secret:, password: ) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? raise Appwrite::Exception.new('Missing required parameter: "secret"') end if password.nil? raise Appwrite::Exception.new('Missing required parameter: "password"') end api_path = '/account/recovery/otp' api_params = { userId: user_id, secret: secret, password: password, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PUT', path: api_path, headers: api_headers, params: api_params, response_type: Models::Token ) end |
#update_session(session_id:) ⇒ Session
Use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider.
1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 |
# File 'lib/appwrite/services/account.rb', line 1992 def update_session( session_id: ) if session_id.nil? || session_id == '' raise Appwrite::Exception.new('Missing required parameter: "sessionId"') end api_path = '/account/sessions/{sessionId}' .gsub('{sessionId}', @client.encode_path(session_id)) api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::Session ) end |
#update_status ⇒ User
Block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead.
2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 |
# File 'lib/appwrite/services/account.rb', line 2060 def update_status() api_path = '/account/status' api_params = {} api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PATCH', path: api_path, headers: api_headers, params: api_params, response_type: Models::User ) end |
#update_verification(user_id:, secret:) ⇒ Token
This API has been deprecated since 1.8.0. Please use Account.updateEmailVerification instead.
Use this endpoint to complete the user email verification process. Use both the userId and secret parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 |
# File 'lib/appwrite/services/account.rb', line 2535 def update_verification( user_id:, secret: ) if user_id.nil? raise Appwrite::Exception.new('Missing required parameter: "userId"') end if secret.nil? raise Appwrite::Exception.new('Missing required parameter: "secret"') end api_path = '/account/verifications/email' api_params = { userId: user_id, secret: secret, } api_headers = { "X-Appwrite-Project": @client.get_config('project'), "content-type": 'application/json', "accept": 'application/json', } @client.call( method: 'PUT', path: api_path, headers: api_headers, params: api_params, response_type: Models::Token ) end |