node-appwrite 17.2.0 → 19.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -2
- package/dist/client.js +3 -3
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +3 -3
- package/dist/client.mjs.map +1 -1
- package/dist/enums/credit-card.d.mts +1 -1
- package/dist/enums/credit-card.d.ts +1 -1
- package/dist/enums/credit-card.js +1 -1
- package/dist/enums/credit-card.js.map +1 -1
- package/dist/enums/credit-card.mjs +1 -1
- package/dist/enums/credit-card.mjs.map +1 -1
- package/dist/enums/execution-method.d.mts +2 -1
- package/dist/enums/execution-method.d.ts +2 -1
- package/dist/enums/execution-method.js +1 -0
- package/dist/enums/execution-method.js.map +1 -1
- package/dist/enums/execution-method.mjs +1 -0
- package/dist/enums/execution-method.mjs.map +1 -1
- package/dist/enums/index-type.d.mts +2 -1
- package/dist/enums/index-type.d.ts +2 -1
- package/dist/enums/index-type.js +1 -0
- package/dist/enums/index-type.js.map +1 -1
- package/dist/enums/index-type.mjs +1 -0
- package/dist/enums/index-type.mjs.map +1 -1
- package/dist/enums/{v-c-s-deployment-type.js → vcs-deployment-type.js} +1 -1
- package/dist/enums/vcs-deployment-type.js.map +1 -0
- package/dist/enums/{v-c-s-deployment-type.mjs → vcs-deployment-type.mjs} +2 -2
- package/dist/enums/vcs-deployment-type.mjs.map +1 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/dist/models.d.mts +1058 -153
- package/dist/models.d.ts +1058 -153
- package/dist/query.d.mts +196 -6
- package/dist/query.d.ts +196 -6
- package/dist/query.js +192 -2
- package/dist/query.js.map +1 -1
- package/dist/query.mjs +192 -2
- package/dist/query.mjs.map +1 -1
- package/dist/services/account.d.mts +625 -70
- package/dist/services/account.d.ts +625 -70
- package/dist/services/account.js +592 -292
- package/dist/services/account.js.map +1 -1
- package/dist/services/account.mjs +592 -292
- package/dist/services/account.mjs.map +1 -1
- package/dist/services/avatars.d.mts +157 -26
- package/dist/services/avatars.d.ts +157 -26
- package/dist/services/avatars.js +104 -93
- package/dist/services/avatars.js.map +1 -1
- package/dist/services/avatars.mjs +104 -93
- package/dist/services/avatars.mjs.map +1 -1
- package/dist/services/databases.d.mts +1425 -248
- package/dist/services/databases.d.ts +1425 -248
- package/dist/services/databases.js +1186 -611
- package/dist/services/databases.js.map +1 -1
- package/dist/services/databases.mjs +1186 -611
- package/dist/services/databases.mjs.map +1 -1
- package/dist/services/functions.d.mts +530 -107
- package/dist/services/functions.d.ts +530 -107
- package/dist/services/functions.js +393 -276
- package/dist/services/functions.js.map +1 -1
- package/dist/services/functions.mjs +393 -276
- package/dist/services/functions.mjs.map +1 -1
- package/dist/services/graphql.d.mts +24 -2
- package/dist/services/graphql.d.ts +24 -2
- package/dist/services/graphql.js +20 -16
- package/dist/services/graphql.js.map +1 -1
- package/dist/services/graphql.mjs +20 -16
- package/dist/services/graphql.mjs.map +1 -1
- package/dist/services/health.d.mts +175 -16
- package/dist/services/health.d.ts +175 -16
- package/dist/services/health.js +144 -115
- package/dist/services/health.js.map +1 -1
- package/dist/services/health.mjs +144 -115
- package/dist/services/health.mjs.map +1 -1
- package/dist/services/locale.js.map +1 -1
- package/dist/services/locale.mjs.map +1 -1
- package/dist/services/messaging.d.mts +1544 -262
- package/dist/services/messaging.d.ts +1544 -262
- package/dist/services/messaging.js +1417 -592
- package/dist/services/messaging.js.map +1 -1
- package/dist/services/messaging.mjs +1417 -592
- package/dist/services/messaging.mjs.map +1 -1
- package/dist/services/sites.d.mts +495 -99
- package/dist/services/sites.d.ts +495 -99
- package/dist/services/sites.js +371 -258
- package/dist/services/sites.js.map +1 -1
- package/dist/services/sites.mjs +371 -258
- package/dist/services/sites.mjs.map +1 -1
- package/dist/services/storage.d.mts +306 -63
- package/dist/services/storage.d.ts +306 -63
- package/dist/services/storage.js +225 -158
- package/dist/services/storage.js.map +1 -1
- package/dist/services/storage.mjs +225 -158
- package/dist/services/storage.mjs.map +1 -1
- package/dist/services/tables-db.d.mts +1744 -0
- package/dist/services/tables-db.d.ts +1744 -0
- package/dist/services/tables-db.js +2692 -0
- package/dist/services/tables-db.js.map +1 -0
- package/dist/services/tables-db.mjs +2691 -0
- package/dist/services/tables-db.mjs.map +1 -0
- package/dist/services/teams.d.mts +233 -39
- package/dist/services/teams.d.ts +233 -39
- package/dist/services/teams.js +170 -135
- package/dist/services/teams.js.map +1 -1
- package/dist/services/teams.mjs +170 -135
- package/dist/services/teams.mjs.map +1 -1
- package/dist/services/tokens.d.mts +76 -11
- package/dist/services/tokens.d.ts +76 -11
- package/dist/services/tokens.js +60 -45
- package/dist/services/tokens.js.map +1 -1
- package/dist/services/tokens.mjs +60 -45
- package/dist/services/tokens.mjs.map +1 -1
- package/dist/services/users.d.mts +842 -115
- package/dist/services/users.d.ts +842 -115
- package/dist/services/users.js +719 -408
- package/dist/services/users.js.map +1 -1
- package/dist/services/users.mjs +719 -408
- package/dist/services/users.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/enums/v-c-s-deployment-type.js.map +0 -1
- package/dist/enums/v-c-s-deployment-type.mjs.map +0 -1
- /package/dist/enums/{v-c-s-deployment-type.d.mts → vcs-deployment-type.d.mts} +0 -0
- /package/dist/enums/{v-c-s-deployment-type.d.ts → vcs-deployment-type.d.ts} +0 -0
|
@@ -18,40 +18,94 @@ declare class Account {
|
|
|
18
18
|
/**
|
|
19
19
|
* 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](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) 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](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
|
|
20
20
|
*
|
|
21
|
-
* @param {string} userId
|
|
22
|
-
* @param {string} email
|
|
23
|
-
* @param {string} password
|
|
24
|
-
* @param {string} name
|
|
21
|
+
* @param {string} params.userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
22
|
+
* @param {string} params.email - User email.
|
|
23
|
+
* @param {string} params.password - New user password. Must be between 8 and 256 chars.
|
|
24
|
+
* @param {string} params.name - User name. Max length: 128 chars.
|
|
25
25
|
* @throws {AppwriteException}
|
|
26
26
|
* @returns {Promise<Models.User<Preferences>>}
|
|
27
27
|
*/
|
|
28
|
+
create<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
|
|
29
|
+
userId: string;
|
|
30
|
+
email: string;
|
|
31
|
+
password: string;
|
|
32
|
+
name?: string;
|
|
33
|
+
}): Promise<Models.User<Preferences>>;
|
|
34
|
+
/**
|
|
35
|
+
* 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](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) 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](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
|
|
36
|
+
*
|
|
37
|
+
* @param {string} userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
38
|
+
* @param {string} email - User email.
|
|
39
|
+
* @param {string} password - New user password. Must be between 8 and 256 chars.
|
|
40
|
+
* @param {string} name - User name. Max length: 128 chars.
|
|
41
|
+
* @throws {AppwriteException}
|
|
42
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
43
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
44
|
+
*/
|
|
28
45
|
create<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>;
|
|
29
46
|
/**
|
|
30
47
|
* 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.
|
|
31
48
|
* This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
|
|
32
49
|
*
|
|
33
50
|
*
|
|
34
|
-
* @param {string} email
|
|
35
|
-
* @param {string} password
|
|
51
|
+
* @param {string} params.email - User email.
|
|
52
|
+
* @param {string} params.password - User password. Must be at least 8 chars.
|
|
53
|
+
* @throws {AppwriteException}
|
|
54
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
55
|
+
*/
|
|
56
|
+
updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
|
|
57
|
+
email: string;
|
|
58
|
+
password: string;
|
|
59
|
+
}): Promise<Models.User<Preferences>>;
|
|
60
|
+
/**
|
|
61
|
+
* 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.
|
|
62
|
+
* This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
|
|
63
|
+
*
|
|
64
|
+
*
|
|
65
|
+
* @param {string} email - User email.
|
|
66
|
+
* @param {string} password - User password. Must be at least 8 chars.
|
|
36
67
|
* @throws {AppwriteException}
|
|
37
68
|
* @returns {Promise<Models.User<Preferences>>}
|
|
69
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
38
70
|
*/
|
|
39
71
|
updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(email: string, password: string): Promise<Models.User<Preferences>>;
|
|
40
72
|
/**
|
|
41
73
|
* Get the list of identities for the currently logged in user.
|
|
42
74
|
*
|
|
43
|
-
* @param {string[]} queries
|
|
75
|
+
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
|
|
44
76
|
* @throws {AppwriteException}
|
|
45
77
|
* @returns {Promise<Models.IdentityList>}
|
|
46
78
|
*/
|
|
79
|
+
listIdentities(params?: {
|
|
80
|
+
queries?: string[];
|
|
81
|
+
}): Promise<Models.IdentityList>;
|
|
82
|
+
/**
|
|
83
|
+
* Get the list of identities for the currently logged in user.
|
|
84
|
+
*
|
|
85
|
+
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
|
|
86
|
+
* @throws {AppwriteException}
|
|
87
|
+
* @returns {Promise<Models.IdentityList>}
|
|
88
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
89
|
+
*/
|
|
47
90
|
listIdentities(queries?: string[]): Promise<Models.IdentityList>;
|
|
48
91
|
/**
|
|
49
92
|
* Delete an identity by its unique ID.
|
|
50
93
|
*
|
|
51
|
-
* @param {string} identityId
|
|
94
|
+
* @param {string} params.identityId - Identity ID.
|
|
52
95
|
* @throws {AppwriteException}
|
|
53
96
|
* @returns {Promise<{}>}
|
|
54
97
|
*/
|
|
98
|
+
deleteIdentity(params: {
|
|
99
|
+
identityId: string;
|
|
100
|
+
}): Promise<{}>;
|
|
101
|
+
/**
|
|
102
|
+
* Delete an identity by its unique ID.
|
|
103
|
+
*
|
|
104
|
+
* @param {string} identityId - Identity ID.
|
|
105
|
+
* @throws {AppwriteException}
|
|
106
|
+
* @returns {Promise<{}>}
|
|
107
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
108
|
+
*/
|
|
55
109
|
deleteIdentity(identityId: string): Promise<{}>;
|
|
56
110
|
/**
|
|
57
111
|
* Use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.
|
|
@@ -63,114 +117,370 @@ declare class Account {
|
|
|
63
117
|
/**
|
|
64
118
|
* Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.
|
|
65
119
|
*
|
|
66
|
-
* @param {string[]} queries
|
|
120
|
+
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
|
|
67
121
|
* @throws {AppwriteException}
|
|
68
122
|
* @returns {Promise<Models.LogList>}
|
|
69
123
|
*/
|
|
124
|
+
listLogs(params?: {
|
|
125
|
+
queries?: string[];
|
|
126
|
+
}): Promise<Models.LogList>;
|
|
127
|
+
/**
|
|
128
|
+
* Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.
|
|
129
|
+
*
|
|
130
|
+
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
|
|
131
|
+
* @throws {AppwriteException}
|
|
132
|
+
* @returns {Promise<Models.LogList>}
|
|
133
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
134
|
+
*/
|
|
70
135
|
listLogs(queries?: string[]): Promise<Models.LogList>;
|
|
71
136
|
/**
|
|
72
137
|
* Enable or disable MFA on an account.
|
|
73
138
|
*
|
|
74
|
-
* @param {boolean} mfa
|
|
139
|
+
* @param {boolean} params.mfa - Enable or disable MFA.
|
|
140
|
+
* @throws {AppwriteException}
|
|
141
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
142
|
+
*/
|
|
143
|
+
updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
|
|
144
|
+
mfa: boolean;
|
|
145
|
+
}): Promise<Models.User<Preferences>>;
|
|
146
|
+
/**
|
|
147
|
+
* Enable or disable MFA on an account.
|
|
148
|
+
*
|
|
149
|
+
* @param {boolean} mfa - Enable or disable MFA.
|
|
75
150
|
* @throws {AppwriteException}
|
|
76
151
|
* @returns {Promise<Models.User<Preferences>>}
|
|
152
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
77
153
|
*/
|
|
78
154
|
updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(mfa: boolean): Promise<Models.User<Preferences>>;
|
|
79
155
|
/**
|
|
80
156
|
* Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
|
|
81
157
|
*
|
|
82
|
-
* @param {AuthenticatorType} type
|
|
158
|
+
* @param {AuthenticatorType} params.type - Type of authenticator. Must be `totp`
|
|
159
|
+
* @throws {AppwriteException}
|
|
160
|
+
* @returns {Promise<Models.MfaType>}
|
|
161
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAAuthenticator` instead.
|
|
162
|
+
*/
|
|
163
|
+
createMfaAuthenticator(params: {
|
|
164
|
+
type: AuthenticatorType;
|
|
165
|
+
}): Promise<Models.MfaType>;
|
|
166
|
+
/**
|
|
167
|
+
* Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
|
|
168
|
+
*
|
|
169
|
+
* @param {AuthenticatorType} type - Type of authenticator. Must be `totp`
|
|
83
170
|
* @throws {AppwriteException}
|
|
84
171
|
* @returns {Promise<Models.MfaType>}
|
|
172
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
85
173
|
*/
|
|
86
174
|
createMfaAuthenticator(type: AuthenticatorType): Promise<Models.MfaType>;
|
|
175
|
+
/**
|
|
176
|
+
* Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
|
|
177
|
+
*
|
|
178
|
+
* @param {AuthenticatorType} params.type - Type of authenticator. Must be `totp`
|
|
179
|
+
* @throws {AppwriteException}
|
|
180
|
+
* @returns {Promise<Models.MfaType>}
|
|
181
|
+
*/
|
|
182
|
+
createMFAAuthenticator(params: {
|
|
183
|
+
type: AuthenticatorType;
|
|
184
|
+
}): Promise<Models.MfaType>;
|
|
185
|
+
/**
|
|
186
|
+
* Add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
|
|
187
|
+
*
|
|
188
|
+
* @param {AuthenticatorType} type - Type of authenticator. Must be `totp`
|
|
189
|
+
* @throws {AppwriteException}
|
|
190
|
+
* @returns {Promise<Models.MfaType>}
|
|
191
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
192
|
+
*/
|
|
193
|
+
createMFAAuthenticator(type: AuthenticatorType): Promise<Models.MfaType>;
|
|
194
|
+
/**
|
|
195
|
+
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
|
|
196
|
+
*
|
|
197
|
+
* @param {AuthenticatorType} params.type - Type of authenticator.
|
|
198
|
+
* @param {string} params.otp - Valid verification token.
|
|
199
|
+
* @throws {AppwriteException}
|
|
200
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
201
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead.
|
|
202
|
+
*/
|
|
203
|
+
updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
|
|
204
|
+
type: AuthenticatorType;
|
|
205
|
+
otp: string;
|
|
206
|
+
}): Promise<Models.User<Preferences>>;
|
|
87
207
|
/**
|
|
88
208
|
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
|
|
89
209
|
*
|
|
90
|
-
* @param {AuthenticatorType} type
|
|
91
|
-
* @param {string} otp
|
|
210
|
+
* @param {AuthenticatorType} type - Type of authenticator.
|
|
211
|
+
* @param {string} otp - Valid verification token.
|
|
92
212
|
* @throws {AppwriteException}
|
|
93
213
|
* @returns {Promise<Models.User<Preferences>>}
|
|
214
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
94
215
|
*/
|
|
95
216
|
updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>;
|
|
217
|
+
/**
|
|
218
|
+
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
|
|
219
|
+
*
|
|
220
|
+
* @param {AuthenticatorType} params.type - Type of authenticator.
|
|
221
|
+
* @param {string} params.otp - Valid verification token.
|
|
222
|
+
* @throws {AppwriteException}
|
|
223
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
224
|
+
*/
|
|
225
|
+
updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
|
|
226
|
+
type: AuthenticatorType;
|
|
227
|
+
otp: string;
|
|
228
|
+
}): Promise<Models.User<Preferences>>;
|
|
229
|
+
/**
|
|
230
|
+
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
|
|
231
|
+
*
|
|
232
|
+
* @param {AuthenticatorType} type - Type of authenticator.
|
|
233
|
+
* @param {string} otp - Valid verification token.
|
|
234
|
+
* @throws {AppwriteException}
|
|
235
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
236
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
237
|
+
*/
|
|
238
|
+
updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>;
|
|
239
|
+
/**
|
|
240
|
+
* Delete an authenticator for a user by ID.
|
|
241
|
+
*
|
|
242
|
+
* @param {AuthenticatorType} params.type - Type of authenticator.
|
|
243
|
+
* @throws {AppwriteException}
|
|
244
|
+
* @returns {Promise<{}>}
|
|
245
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.deleteMFAAuthenticator` instead.
|
|
246
|
+
*/
|
|
247
|
+
deleteMfaAuthenticator(params: {
|
|
248
|
+
type: AuthenticatorType;
|
|
249
|
+
}): Promise<{}>;
|
|
96
250
|
/**
|
|
97
251
|
* Delete an authenticator for a user by ID.
|
|
98
252
|
*
|
|
99
|
-
* @param {AuthenticatorType} type
|
|
253
|
+
* @param {AuthenticatorType} type - Type of authenticator.
|
|
100
254
|
* @throws {AppwriteException}
|
|
101
255
|
* @returns {Promise<{}>}
|
|
256
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
102
257
|
*/
|
|
103
258
|
deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}>;
|
|
259
|
+
/**
|
|
260
|
+
* Delete an authenticator for a user by ID.
|
|
261
|
+
*
|
|
262
|
+
* @param {AuthenticatorType} params.type - Type of authenticator.
|
|
263
|
+
* @throws {AppwriteException}
|
|
264
|
+
* @returns {Promise<{}>}
|
|
265
|
+
*/
|
|
266
|
+
deleteMFAAuthenticator(params: {
|
|
267
|
+
type: AuthenticatorType;
|
|
268
|
+
}): Promise<{}>;
|
|
269
|
+
/**
|
|
270
|
+
* Delete an authenticator for a user by ID.
|
|
271
|
+
*
|
|
272
|
+
* @param {AuthenticatorType} type - Type of authenticator.
|
|
273
|
+
* @throws {AppwriteException}
|
|
274
|
+
* @returns {Promise<{}>}
|
|
275
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
276
|
+
*/
|
|
277
|
+
deleteMFAAuthenticator(type: AuthenticatorType): Promise<{}>;
|
|
104
278
|
/**
|
|
105
279
|
* Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
|
|
106
280
|
*
|
|
107
|
-
* @param {AuthenticationFactor} factor
|
|
281
|
+
* @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
|
|
108
282
|
* @throws {AppwriteException}
|
|
109
283
|
* @returns {Promise<Models.MfaChallenge>}
|
|
284
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead.
|
|
285
|
+
*/
|
|
286
|
+
createMfaChallenge(params: {
|
|
287
|
+
factor: AuthenticationFactor;
|
|
288
|
+
}): Promise<Models.MfaChallenge>;
|
|
289
|
+
/**
|
|
290
|
+
* Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
|
|
291
|
+
*
|
|
292
|
+
* @param {AuthenticationFactor} factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
|
|
293
|
+
* @throws {AppwriteException}
|
|
294
|
+
* @returns {Promise<Models.MfaChallenge>}
|
|
295
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
110
296
|
*/
|
|
111
297
|
createMfaChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge>;
|
|
298
|
+
/**
|
|
299
|
+
* Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
|
|
300
|
+
*
|
|
301
|
+
* @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
|
|
302
|
+
* @throws {AppwriteException}
|
|
303
|
+
* @returns {Promise<Models.MfaChallenge>}
|
|
304
|
+
*/
|
|
305
|
+
createMFAChallenge(params: {
|
|
306
|
+
factor: AuthenticationFactor;
|
|
307
|
+
}): Promise<Models.MfaChallenge>;
|
|
308
|
+
/**
|
|
309
|
+
* Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
|
|
310
|
+
*
|
|
311
|
+
* @param {AuthenticationFactor} factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`.
|
|
312
|
+
* @throws {AppwriteException}
|
|
313
|
+
* @returns {Promise<Models.MfaChallenge>}
|
|
314
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
315
|
+
*/
|
|
316
|
+
createMFAChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge>;
|
|
317
|
+
/**
|
|
318
|
+
* 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](/docs/references/cloud/client-web/account#createMfaChallenge) method.
|
|
319
|
+
*
|
|
320
|
+
* @param {string} params.challengeId - ID of the challenge.
|
|
321
|
+
* @param {string} params.otp - Valid verification token.
|
|
322
|
+
* @throws {AppwriteException}
|
|
323
|
+
* @returns {Promise<Models.Session>}
|
|
324
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFAChallenge` instead.
|
|
325
|
+
*/
|
|
326
|
+
updateMfaChallenge(params: {
|
|
327
|
+
challengeId: string;
|
|
328
|
+
otp: string;
|
|
329
|
+
}): Promise<Models.Session>;
|
|
112
330
|
/**
|
|
113
331
|
* 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](/docs/references/cloud/client-web/account#createMfaChallenge) method.
|
|
114
332
|
*
|
|
115
|
-
* @param {string} challengeId
|
|
116
|
-
* @param {string} otp
|
|
333
|
+
* @param {string} challengeId - ID of the challenge.
|
|
334
|
+
* @param {string} otp - Valid verification token.
|
|
117
335
|
* @throws {AppwriteException}
|
|
118
336
|
* @returns {Promise<Models.Session>}
|
|
337
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
119
338
|
*/
|
|
120
339
|
updateMfaChallenge(challengeId: string, otp: string): Promise<Models.Session>;
|
|
340
|
+
/**
|
|
341
|
+
* 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](/docs/references/cloud/client-web/account#createMfaChallenge) method.
|
|
342
|
+
*
|
|
343
|
+
* @param {string} params.challengeId - ID of the challenge.
|
|
344
|
+
* @param {string} params.otp - Valid verification token.
|
|
345
|
+
* @throws {AppwriteException}
|
|
346
|
+
* @returns {Promise<Models.Session>}
|
|
347
|
+
*/
|
|
348
|
+
updateMFAChallenge(params: {
|
|
349
|
+
challengeId: string;
|
|
350
|
+
otp: string;
|
|
351
|
+
}): Promise<Models.Session>;
|
|
352
|
+
/**
|
|
353
|
+
* 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](/docs/references/cloud/client-web/account#createMfaChallenge) method.
|
|
354
|
+
*
|
|
355
|
+
* @param {string} challengeId - ID of the challenge.
|
|
356
|
+
* @param {string} otp - Valid verification token.
|
|
357
|
+
* @throws {AppwriteException}
|
|
358
|
+
* @returns {Promise<Models.Session>}
|
|
359
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
360
|
+
*/
|
|
361
|
+
updateMFAChallenge(challengeId: string, otp: string): Promise<Models.Session>;
|
|
121
362
|
/**
|
|
122
363
|
* List the factors available on the account to be used as a MFA challange.
|
|
123
364
|
*
|
|
124
365
|
* @throws {AppwriteException}
|
|
125
366
|
* @returns {Promise<Models.MfaFactors>}
|
|
367
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.listMFAFactors` instead.
|
|
126
368
|
*/
|
|
127
369
|
listMfaFactors(): Promise<Models.MfaFactors>;
|
|
370
|
+
/**
|
|
371
|
+
* List the factors available on the account to be used as a MFA challange.
|
|
372
|
+
*
|
|
373
|
+
* @throws {AppwriteException}
|
|
374
|
+
* @returns {Promise<Models.MfaFactors>}
|
|
375
|
+
*/
|
|
376
|
+
listMFAFactors(): Promise<Models.MfaFactors>;
|
|
128
377
|
/**
|
|
129
378
|
* Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.
|
|
130
379
|
*
|
|
131
380
|
* @throws {AppwriteException}
|
|
132
381
|
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
382
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.getMFARecoveryCodes` instead.
|
|
133
383
|
*/
|
|
134
384
|
getMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
|
|
135
385
|
/**
|
|
136
|
-
*
|
|
386
|
+
* Get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.
|
|
387
|
+
*
|
|
388
|
+
* @throws {AppwriteException}
|
|
389
|
+
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
390
|
+
*/
|
|
391
|
+
getMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
|
|
392
|
+
/**
|
|
393
|
+
* 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](/docs/references/cloud/client-web/account#createMfaChallenge) method.
|
|
137
394
|
*
|
|
138
395
|
* @throws {AppwriteException}
|
|
139
396
|
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
397
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead.
|
|
140
398
|
*/
|
|
141
399
|
createMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
|
|
400
|
+
/**
|
|
401
|
+
* 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](/docs/references/cloud/client-web/account#createMfaChallenge) method.
|
|
402
|
+
*
|
|
403
|
+
* @throws {AppwriteException}
|
|
404
|
+
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
405
|
+
*/
|
|
406
|
+
createMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
|
|
142
407
|
/**
|
|
143
408
|
* Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
|
|
144
409
|
*
|
|
145
410
|
* @throws {AppwriteException}
|
|
146
411
|
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
412
|
+
* @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead.
|
|
147
413
|
*/
|
|
148
414
|
updateMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
|
|
415
|
+
/**
|
|
416
|
+
* Regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
|
|
417
|
+
*
|
|
418
|
+
* @throws {AppwriteException}
|
|
419
|
+
* @returns {Promise<Models.MfaRecoveryCodes>}
|
|
420
|
+
*/
|
|
421
|
+
updateMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
|
|
149
422
|
/**
|
|
150
423
|
* Update currently logged in user account name.
|
|
151
424
|
*
|
|
152
|
-
* @param {string} name
|
|
425
|
+
* @param {string} params.name - User name. Max length: 128 chars.
|
|
153
426
|
* @throws {AppwriteException}
|
|
154
427
|
* @returns {Promise<Models.User<Preferences>>}
|
|
155
428
|
*/
|
|
429
|
+
updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
|
|
430
|
+
name: string;
|
|
431
|
+
}): Promise<Models.User<Preferences>>;
|
|
432
|
+
/**
|
|
433
|
+
* Update currently logged in user account name.
|
|
434
|
+
*
|
|
435
|
+
* @param {string} name - User name. Max length: 128 chars.
|
|
436
|
+
* @throws {AppwriteException}
|
|
437
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
438
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
439
|
+
*/
|
|
156
440
|
updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(name: string): Promise<Models.User<Preferences>>;
|
|
157
441
|
/**
|
|
158
442
|
* 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.
|
|
159
443
|
*
|
|
160
|
-
* @param {string} password
|
|
161
|
-
* @param {string} oldPassword
|
|
444
|
+
* @param {string} params.password - New user password. Must be at least 8 chars.
|
|
445
|
+
* @param {string} params.oldPassword - Current user password. Must be at least 8 chars.
|
|
162
446
|
* @throws {AppwriteException}
|
|
163
447
|
* @returns {Promise<Models.User<Preferences>>}
|
|
164
448
|
*/
|
|
449
|
+
updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
|
|
450
|
+
password: string;
|
|
451
|
+
oldPassword?: string;
|
|
452
|
+
}): Promise<Models.User<Preferences>>;
|
|
453
|
+
/**
|
|
454
|
+
* 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.
|
|
455
|
+
*
|
|
456
|
+
* @param {string} password - New user password. Must be at least 8 chars.
|
|
457
|
+
* @param {string} oldPassword - Current user password. Must be at least 8 chars.
|
|
458
|
+
* @throws {AppwriteException}
|
|
459
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
460
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
461
|
+
*/
|
|
165
462
|
updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences>>;
|
|
166
463
|
/**
|
|
167
|
-
* Update the currently logged in user
|
|
464
|
+
* 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](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.
|
|
168
465
|
*
|
|
169
|
-
* @param {string} phone
|
|
170
|
-
* @param {string} password
|
|
466
|
+
* @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
|
467
|
+
* @param {string} params.password - User password. Must be at least 8 chars.
|
|
171
468
|
* @throws {AppwriteException}
|
|
172
469
|
* @returns {Promise<Models.User<Preferences>>}
|
|
173
470
|
*/
|
|
471
|
+
updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
|
|
472
|
+
phone: string;
|
|
473
|
+
password: string;
|
|
474
|
+
}): Promise<Models.User<Preferences>>;
|
|
475
|
+
/**
|
|
476
|
+
* 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](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.
|
|
477
|
+
*
|
|
478
|
+
* @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
|
479
|
+
* @param {string} password - User password. Must be at least 8 chars.
|
|
480
|
+
* @throws {AppwriteException}
|
|
481
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
482
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
483
|
+
*/
|
|
174
484
|
updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(phone: string, password: string): Promise<Models.User<Preferences>>;
|
|
175
485
|
/**
|
|
176
486
|
* Get the preferences as a key-value object for the currently logged in user.
|
|
@@ -182,18 +492,42 @@ declare class Account {
|
|
|
182
492
|
/**
|
|
183
493
|
* 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.
|
|
184
494
|
*
|
|
185
|
-
* @param {Partial<Preferences>} prefs
|
|
495
|
+
* @param {Partial<Preferences>} params.prefs - Prefs key-value JSON object.
|
|
496
|
+
* @throws {AppwriteException}
|
|
497
|
+
* @returns {Promise<Models.User<Preferences>>}
|
|
498
|
+
*/
|
|
499
|
+
updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: {
|
|
500
|
+
prefs: Partial<Preferences>;
|
|
501
|
+
}): Promise<Models.User<Preferences>>;
|
|
502
|
+
/**
|
|
503
|
+
* 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.
|
|
504
|
+
*
|
|
505
|
+
* @param {Partial<Preferences>} prefs - Prefs key-value JSON object.
|
|
186
506
|
* @throws {AppwriteException}
|
|
187
507
|
* @returns {Promise<Models.User<Preferences>>}
|
|
508
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
188
509
|
*/
|
|
189
510
|
updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(prefs: Partial<Preferences>): Promise<Models.User<Preferences>>;
|
|
190
511
|
/**
|
|
191
|
-
* 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](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user
|
|
512
|
+
* 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](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.
|
|
513
|
+
*
|
|
514
|
+
* @param {string} params.email - User email.
|
|
515
|
+
* @param {string} params.url - URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
516
|
+
* @throws {AppwriteException}
|
|
517
|
+
* @returns {Promise<Models.Token>}
|
|
518
|
+
*/
|
|
519
|
+
createRecovery(params: {
|
|
520
|
+
email: string;
|
|
521
|
+
url: string;
|
|
522
|
+
}): Promise<Models.Token>;
|
|
523
|
+
/**
|
|
524
|
+
* 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](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.
|
|
192
525
|
*
|
|
193
|
-
* @param {string} email
|
|
194
|
-
* @param {string} url
|
|
526
|
+
* @param {string} email - User email.
|
|
527
|
+
* @param {string} url - URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
195
528
|
* @throws {AppwriteException}
|
|
196
529
|
* @returns {Promise<Models.Token>}
|
|
530
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
197
531
|
*/
|
|
198
532
|
createRecovery(email: string, url: string): Promise<Models.Token>;
|
|
199
533
|
/**
|
|
@@ -201,11 +535,28 @@ declare class Account {
|
|
|
201
535
|
*
|
|
202
536
|
* Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
|
|
203
537
|
*
|
|
204
|
-
* @param {string} userId
|
|
205
|
-
* @param {string} secret
|
|
206
|
-
* @param {string} password
|
|
538
|
+
* @param {string} params.userId - User ID.
|
|
539
|
+
* @param {string} params.secret - Valid reset token.
|
|
540
|
+
* @param {string} params.password - New user password. Must be between 8 and 256 chars.
|
|
541
|
+
* @throws {AppwriteException}
|
|
542
|
+
* @returns {Promise<Models.Token>}
|
|
543
|
+
*/
|
|
544
|
+
updateRecovery(params: {
|
|
545
|
+
userId: string;
|
|
546
|
+
secret: string;
|
|
547
|
+
password: string;
|
|
548
|
+
}): Promise<Models.Token>;
|
|
549
|
+
/**
|
|
550
|
+
* 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](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint.
|
|
551
|
+
*
|
|
552
|
+
* Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
|
|
553
|
+
*
|
|
554
|
+
* @param {string} userId - User ID.
|
|
555
|
+
* @param {string} secret - Valid reset token.
|
|
556
|
+
* @param {string} password - New user password. Must be between 8 and 256 chars.
|
|
207
557
|
* @throws {AppwriteException}
|
|
208
558
|
* @returns {Promise<Models.Token>}
|
|
559
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
209
560
|
*/
|
|
210
561
|
updateRecovery(userId: string, secret: string, password: string): Promise<Models.Token>;
|
|
211
562
|
/**
|
|
@@ -234,61 +585,150 @@ declare class Account {
|
|
|
234
585
|
*
|
|
235
586
|
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
236
587
|
*
|
|
237
|
-
* @param {string} email
|
|
238
|
-
* @param {string} password
|
|
588
|
+
* @param {string} params.email - User email.
|
|
589
|
+
* @param {string} params.password - User password. Must be at least 8 chars.
|
|
239
590
|
* @throws {AppwriteException}
|
|
240
591
|
* @returns {Promise<Models.Session>}
|
|
241
592
|
*/
|
|
593
|
+
createEmailPasswordSession(params: {
|
|
594
|
+
email: string;
|
|
595
|
+
password: string;
|
|
596
|
+
}): Promise<Models.Session>;
|
|
597
|
+
/**
|
|
598
|
+
* 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.
|
|
599
|
+
*
|
|
600
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
601
|
+
*
|
|
602
|
+
* @param {string} email - User email.
|
|
603
|
+
* @param {string} password - User password. Must be at least 8 chars.
|
|
604
|
+
* @throws {AppwriteException}
|
|
605
|
+
* @returns {Promise<Models.Session>}
|
|
606
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
607
|
+
*/
|
|
242
608
|
createEmailPasswordSession(email: string, password: string): Promise<Models.Session>;
|
|
243
609
|
/**
|
|
244
610
|
* 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.
|
|
245
611
|
*
|
|
246
|
-
* @param {string} userId
|
|
247
|
-
* @param {string} secret
|
|
612
|
+
* @param {string} params.userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
613
|
+
* @param {string} params.secret - Valid verification token.
|
|
248
614
|
* @throws {AppwriteException}
|
|
249
615
|
* @returns {Promise<Models.Session>}
|
|
616
|
+
* @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.
|
|
617
|
+
*/
|
|
618
|
+
updateMagicURLSession(params: {
|
|
619
|
+
userId: string;
|
|
620
|
+
secret: string;
|
|
621
|
+
}): Promise<Models.Session>;
|
|
622
|
+
/**
|
|
623
|
+
* 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.
|
|
624
|
+
*
|
|
625
|
+
* @param {string} userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
626
|
+
* @param {string} secret - Valid verification token.
|
|
627
|
+
* @throws {AppwriteException}
|
|
628
|
+
* @returns {Promise<Models.Session>}
|
|
629
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
250
630
|
*/
|
|
251
631
|
updateMagicURLSession(userId: string, secret: string): Promise<Models.Session>;
|
|
252
632
|
/**
|
|
253
633
|
* 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.
|
|
254
634
|
*
|
|
255
|
-
* @param {string} userId
|
|
256
|
-
* @param {string} secret
|
|
635
|
+
* @param {string} params.userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
636
|
+
* @param {string} params.secret - Valid verification token.
|
|
257
637
|
* @throws {AppwriteException}
|
|
258
638
|
* @returns {Promise<Models.Session>}
|
|
639
|
+
* @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead.
|
|
640
|
+
*/
|
|
641
|
+
updatePhoneSession(params: {
|
|
642
|
+
userId: string;
|
|
643
|
+
secret: string;
|
|
644
|
+
}): Promise<Models.Session>;
|
|
645
|
+
/**
|
|
646
|
+
* 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.
|
|
647
|
+
*
|
|
648
|
+
* @param {string} userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
649
|
+
* @param {string} secret - Valid verification token.
|
|
650
|
+
* @throws {AppwriteException}
|
|
651
|
+
* @returns {Promise<Models.Session>}
|
|
652
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
259
653
|
*/
|
|
260
654
|
updatePhoneSession(userId: string, secret: string): Promise<Models.Session>;
|
|
261
655
|
/**
|
|
262
656
|
* 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.
|
|
263
657
|
*
|
|
264
|
-
* @param {string} userId
|
|
265
|
-
* @param {string} secret
|
|
658
|
+
* @param {string} params.userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
659
|
+
* @param {string} params.secret - Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods.
|
|
660
|
+
* @throws {AppwriteException}
|
|
661
|
+
* @returns {Promise<Models.Session>}
|
|
662
|
+
*/
|
|
663
|
+
createSession(params: {
|
|
664
|
+
userId: string;
|
|
665
|
+
secret: string;
|
|
666
|
+
}): Promise<Models.Session>;
|
|
667
|
+
/**
|
|
668
|
+
* 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.
|
|
669
|
+
*
|
|
670
|
+
* @param {string} userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
671
|
+
* @param {string} secret - Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods.
|
|
266
672
|
* @throws {AppwriteException}
|
|
267
673
|
* @returns {Promise<Models.Session>}
|
|
674
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
268
675
|
*/
|
|
269
676
|
createSession(userId: string, secret: string): Promise<Models.Session>;
|
|
270
677
|
/**
|
|
271
|
-
* Use this endpoint to get a logged in user
|
|
678
|
+
* Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.
|
|
272
679
|
*
|
|
273
|
-
* @param {string} sessionId
|
|
680
|
+
* @param {string} params.sessionId - Session ID. Use the string 'current' to get the current device session.
|
|
274
681
|
* @throws {AppwriteException}
|
|
275
682
|
* @returns {Promise<Models.Session>}
|
|
276
683
|
*/
|
|
684
|
+
getSession(params: {
|
|
685
|
+
sessionId: string;
|
|
686
|
+
}): Promise<Models.Session>;
|
|
687
|
+
/**
|
|
688
|
+
* Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.
|
|
689
|
+
*
|
|
690
|
+
* @param {string} sessionId - Session ID. Use the string 'current' to get the current device session.
|
|
691
|
+
* @throws {AppwriteException}
|
|
692
|
+
* @returns {Promise<Models.Session>}
|
|
693
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
694
|
+
*/
|
|
277
695
|
getSession(sessionId: string): Promise<Models.Session>;
|
|
278
696
|
/**
|
|
279
|
-
* Use this endpoint to extend a session
|
|
697
|
+
* 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.
|
|
698
|
+
*
|
|
699
|
+
* @param {string} params.sessionId - Session ID. Use the string 'current' to update the current device session.
|
|
700
|
+
* @throws {AppwriteException}
|
|
701
|
+
* @returns {Promise<Models.Session>}
|
|
702
|
+
*/
|
|
703
|
+
updateSession(params: {
|
|
704
|
+
sessionId: string;
|
|
705
|
+
}): Promise<Models.Session>;
|
|
706
|
+
/**
|
|
707
|
+
* 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.
|
|
280
708
|
*
|
|
281
|
-
* @param {string} sessionId
|
|
709
|
+
* @param {string} sessionId - Session ID. Use the string 'current' to update the current device session.
|
|
282
710
|
* @throws {AppwriteException}
|
|
283
711
|
* @returns {Promise<Models.Session>}
|
|
712
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
284
713
|
*/
|
|
285
714
|
updateSession(sessionId: string): Promise<Models.Session>;
|
|
286
715
|
/**
|
|
287
|
-
* Logout the user. Use
|
|
716
|
+
* 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](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead.
|
|
717
|
+
*
|
|
718
|
+
* @param {string} params.sessionId - Session ID. Use the string 'current' to delete the current device session.
|
|
719
|
+
* @throws {AppwriteException}
|
|
720
|
+
* @returns {Promise<{}>}
|
|
721
|
+
*/
|
|
722
|
+
deleteSession(params: {
|
|
723
|
+
sessionId: string;
|
|
724
|
+
}): Promise<{}>;
|
|
725
|
+
/**
|
|
726
|
+
* 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](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead.
|
|
288
727
|
*
|
|
289
|
-
* @param {string} sessionId
|
|
728
|
+
* @param {string} sessionId - Session ID. Use the string 'current' to delete the current device session.
|
|
290
729
|
* @throws {AppwriteException}
|
|
291
730
|
* @returns {Promise<{}>}
|
|
731
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
292
732
|
*/
|
|
293
733
|
deleteSession(sessionId: string): Promise<{}>;
|
|
294
734
|
/**
|
|
@@ -299,91 +739,206 @@ declare class Account {
|
|
|
299
739
|
*/
|
|
300
740
|
updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Models.User<Preferences>>;
|
|
301
741
|
/**
|
|
302
|
-
* Sends the user an email with a secret key for creating a session. If the
|
|
742
|
+
* 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](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes.
|
|
303
743
|
*
|
|
304
744
|
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
305
745
|
*
|
|
306
|
-
*
|
|
307
|
-
* @param {string} email
|
|
308
|
-
* @param {
|
|
746
|
+
*
|
|
747
|
+
* @param {string} params.userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. 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.
|
|
748
|
+
* @param {string} params.email - User email.
|
|
749
|
+
* @param {boolean} params.phrase - Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.
|
|
750
|
+
* @throws {AppwriteException}
|
|
751
|
+
* @returns {Promise<Models.Token>}
|
|
752
|
+
*/
|
|
753
|
+
createEmailToken(params: {
|
|
754
|
+
userId: string;
|
|
755
|
+
email: string;
|
|
756
|
+
phrase?: boolean;
|
|
757
|
+
}): Promise<Models.Token>;
|
|
758
|
+
/**
|
|
759
|
+
* 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](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes.
|
|
760
|
+
*
|
|
761
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
762
|
+
*
|
|
763
|
+
*
|
|
764
|
+
* @param {string} userId - User ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. 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.
|
|
765
|
+
* @param {string} email - User email.
|
|
766
|
+
* @param {boolean} phrase - Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.
|
|
309
767
|
* @throws {AppwriteException}
|
|
310
768
|
* @returns {Promise<Models.Token>}
|
|
769
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
311
770
|
*/
|
|
312
771
|
createEmailToken(userId: string, email: string, phrase?: boolean): Promise<Models.Token>;
|
|
313
772
|
/**
|
|
314
|
-
* 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](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user
|
|
773
|
+
* 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](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour.
|
|
774
|
+
*
|
|
775
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
776
|
+
*
|
|
777
|
+
*
|
|
778
|
+
* @param {string} params.userId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. 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.
|
|
779
|
+
* @param {string} params.email - User email.
|
|
780
|
+
* @param {string} params.url - URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
781
|
+
* @param {boolean} params.phrase - Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.
|
|
782
|
+
* @throws {AppwriteException}
|
|
783
|
+
* @returns {Promise<Models.Token>}
|
|
784
|
+
*/
|
|
785
|
+
createMagicURLToken(params: {
|
|
786
|
+
userId: string;
|
|
787
|
+
email: string;
|
|
788
|
+
url?: string;
|
|
789
|
+
phrase?: boolean;
|
|
790
|
+
}): Promise<Models.Token>;
|
|
791
|
+
/**
|
|
792
|
+
* 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](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour.
|
|
315
793
|
*
|
|
316
794
|
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
317
795
|
*
|
|
318
796
|
*
|
|
319
|
-
* @param {string} userId
|
|
320
|
-
* @param {string} email
|
|
321
|
-
* @param {string} url
|
|
322
|
-
* @param {boolean} phrase
|
|
797
|
+
* @param {string} userId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. 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.
|
|
798
|
+
* @param {string} email - User email.
|
|
799
|
+
* @param {string} url - URL to redirect the user back to your app from the magic URL login. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
800
|
+
* @param {boolean} phrase - Toggle for security phrase. If enabled, email will be send with a randomly generated phrase and the phrase will also be included in the response. Confirming phrases match increases the security of your authentication flow.
|
|
323
801
|
* @throws {AppwriteException}
|
|
324
802
|
* @returns {Promise<Models.Token>}
|
|
803
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
325
804
|
*/
|
|
326
805
|
createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise<Models.Token>;
|
|
327
806
|
/**
|
|
328
|
-
* 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
|
|
807
|
+
* 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.
|
|
329
808
|
*
|
|
330
809
|
* 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](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint.
|
|
331
810
|
*
|
|
332
811
|
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
333
812
|
*
|
|
334
|
-
* @param {OAuthProvider} provider
|
|
335
|
-
* @param {string} success
|
|
336
|
-
* @param {string} failure
|
|
337
|
-
* @param {string[]} scopes
|
|
813
|
+
* @param {OAuthProvider} params.provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
|
|
814
|
+
* @param {string} params.success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
815
|
+
* @param {string} params.failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
816
|
+
* @param {string[]} params.scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
|
|
338
817
|
* @throws {AppwriteException}
|
|
339
818
|
* @returns {Promise<string>}
|
|
340
819
|
*/
|
|
820
|
+
createOAuth2Token(params: {
|
|
821
|
+
provider: OAuthProvider;
|
|
822
|
+
success?: string;
|
|
823
|
+
failure?: string;
|
|
824
|
+
scopes?: string[];
|
|
825
|
+
}): Promise<string>;
|
|
826
|
+
/**
|
|
827
|
+
* 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.
|
|
828
|
+
*
|
|
829
|
+
* 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](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint.
|
|
830
|
+
*
|
|
831
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
832
|
+
*
|
|
833
|
+
* @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, zoom.
|
|
834
|
+
* @param {string} success - URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
835
|
+
* @param {string} failure - URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
836
|
+
* @param {string[]} scopes - A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
|
|
837
|
+
* @throws {AppwriteException}
|
|
838
|
+
* @returns {Promise<string>}
|
|
839
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
840
|
+
*/
|
|
341
841
|
createOAuth2Token(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): Promise<string>;
|
|
342
842
|
/**
|
|
343
|
-
* 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](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user
|
|
843
|
+
* 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](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes.
|
|
344
844
|
*
|
|
345
845
|
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
346
846
|
*
|
|
347
|
-
* @param {string} userId
|
|
348
|
-
* @param {string} phone
|
|
847
|
+
* @param {string} params.userId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored.
|
|
848
|
+
* @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
|
349
849
|
* @throws {AppwriteException}
|
|
350
850
|
* @returns {Promise<Models.Token>}
|
|
351
851
|
*/
|
|
852
|
+
createPhoneToken(params: {
|
|
853
|
+
userId: string;
|
|
854
|
+
phone: string;
|
|
855
|
+
}): Promise<Models.Token>;
|
|
856
|
+
/**
|
|
857
|
+
* 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](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes.
|
|
858
|
+
*
|
|
859
|
+
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
|
|
860
|
+
*
|
|
861
|
+
* @param {string} userId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. If the phone number has never been used, a new account is created using the provided userId. Otherwise, if the phone number is already attached to an account, the user ID is ignored.
|
|
862
|
+
* @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
|
863
|
+
* @throws {AppwriteException}
|
|
864
|
+
* @returns {Promise<Models.Token>}
|
|
865
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
866
|
+
*/
|
|
352
867
|
createPhoneToken(userId: string, phone: string): Promise<Models.Token>;
|
|
353
868
|
/**
|
|
354
|
-
* 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](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user
|
|
869
|
+
* 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](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
|
|
355
870
|
*
|
|
356
871
|
* Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
|
|
357
872
|
*
|
|
358
873
|
*
|
|
359
|
-
* @param {string} url
|
|
874
|
+
* @param {string} params.url - URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
360
875
|
* @throws {AppwriteException}
|
|
361
876
|
* @returns {Promise<Models.Token>}
|
|
362
877
|
*/
|
|
878
|
+
createVerification(params: {
|
|
879
|
+
url: string;
|
|
880
|
+
}): Promise<Models.Token>;
|
|
881
|
+
/**
|
|
882
|
+
* 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](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
|
|
883
|
+
*
|
|
884
|
+
* Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
|
|
885
|
+
*
|
|
886
|
+
*
|
|
887
|
+
* @param {string} url - URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
|
|
888
|
+
* @throws {AppwriteException}
|
|
889
|
+
* @returns {Promise<Models.Token>}
|
|
890
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
891
|
+
*/
|
|
363
892
|
createVerification(url: string): Promise<Models.Token>;
|
|
364
893
|
/**
|
|
365
894
|
* 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.
|
|
366
895
|
*
|
|
367
|
-
* @param {string} userId
|
|
368
|
-
* @param {string} secret
|
|
896
|
+
* @param {string} params.userId - User ID.
|
|
897
|
+
* @param {string} params.secret - Valid verification token.
|
|
369
898
|
* @throws {AppwriteException}
|
|
370
899
|
* @returns {Promise<Models.Token>}
|
|
371
900
|
*/
|
|
901
|
+
updateVerification(params: {
|
|
902
|
+
userId: string;
|
|
903
|
+
secret: string;
|
|
904
|
+
}): Promise<Models.Token>;
|
|
905
|
+
/**
|
|
906
|
+
* 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.
|
|
907
|
+
*
|
|
908
|
+
* @param {string} userId - User ID.
|
|
909
|
+
* @param {string} secret - Valid verification token.
|
|
910
|
+
* @throws {AppwriteException}
|
|
911
|
+
* @returns {Promise<Models.Token>}
|
|
912
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
913
|
+
*/
|
|
372
914
|
updateVerification(userId: string, secret: string): Promise<Models.Token>;
|
|
373
915
|
/**
|
|
374
|
-
* Use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user
|
|
916
|
+
* 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](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes.
|
|
375
917
|
*
|
|
376
918
|
* @throws {AppwriteException}
|
|
377
919
|
* @returns {Promise<Models.Token>}
|
|
378
920
|
*/
|
|
379
921
|
createPhoneVerification(): Promise<Models.Token>;
|
|
380
922
|
/**
|
|
381
|
-
* Use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user
|
|
923
|
+
* 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.
|
|
924
|
+
*
|
|
925
|
+
* @param {string} params.userId - User ID.
|
|
926
|
+
* @param {string} params.secret - Valid verification token.
|
|
927
|
+
* @throws {AppwriteException}
|
|
928
|
+
* @returns {Promise<Models.Token>}
|
|
929
|
+
*/
|
|
930
|
+
updatePhoneVerification(params: {
|
|
931
|
+
userId: string;
|
|
932
|
+
secret: string;
|
|
933
|
+
}): Promise<Models.Token>;
|
|
934
|
+
/**
|
|
935
|
+
* 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.
|
|
382
936
|
*
|
|
383
|
-
* @param {string} userId
|
|
384
|
-
* @param {string} secret
|
|
937
|
+
* @param {string} userId - User ID.
|
|
938
|
+
* @param {string} secret - Valid verification token.
|
|
385
939
|
* @throws {AppwriteException}
|
|
386
940
|
* @returns {Promise<Models.Token>}
|
|
941
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
387
942
|
*/
|
|
388
943
|
updatePhoneVerification(userId: string, secret: string): Promise<Models.Token>;
|
|
389
944
|
}
|