@appconda/nextjs 1.0.158 → 1.0.160
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/dist/actions/index.d.ts +0 -1
- package/dist/actions/index.js +0 -1
- package/dist/getSDKForCurrentUser.d.ts +7 -3
- package/dist/getSDKForCurrentUser.js +9 -3
- package/dist/getSDKForService.d.ts +6 -0
- package/dist/getSDKForService.js +49 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -5
- package/dist/modules/account/actions.d.ts +25 -0
- package/dist/modules/account/actions.js +17 -0
- package/dist/modules/account/enums/authentication-factor.d.ts +6 -0
- package/dist/modules/account/enums/authentication-factor.js +7 -0
- package/dist/modules/account/enums/authenticator-type.d.ts +3 -0
- package/dist/modules/account/enums/authenticator-type.js +4 -0
- package/dist/modules/account/enums/o-auth-provider.d.ts +41 -0
- package/dist/modules/account/enums/o-auth-provider.js +42 -0
- package/dist/modules/account/index.d.ts +3 -0
- package/dist/modules/account/index.js +3 -0
- package/dist/modules/account/schema.d.ts +17 -0
- package/dist/modules/account/schema.js +7 -0
- package/dist/modules/account/service.d.ts +530 -0
- package/dist/modules/account/service.js +1259 -0
- package/dist/modules/account/types.d.ts +411 -0
- package/dist/modules/account/types.js +1 -0
- package/dist/modules/agent/action.d.ts +53 -0
- package/dist/modules/agent/action.js +63 -0
- package/dist/modules/agent/index.d.ts +4 -0
- package/dist/modules/agent/index.js +4 -0
- package/dist/modules/agent/schema.d.ts +48 -0
- package/dist/modules/agent/schema.js +20 -0
- package/dist/modules/agent/service.d.ts +12 -0
- package/dist/modules/agent/service.js +21 -0
- package/dist/modules/agent/types.d.ts +11 -0
- package/dist/modules/agent/types.js +1 -0
- package/dist/modules/ai/index.d.ts +1 -0
- package/dist/modules/ai/index.js +1 -0
- package/dist/modules/ai/node/actions.d.ts +4 -0
- package/dist/modules/ai/node/actions.js +15 -0
- package/dist/modules/ai/node/index.d.ts +2 -0
- package/dist/modules/ai/node/index.js +2 -0
- package/dist/modules/ai/node/service.d.ts +5 -0
- package/dist/modules/ai/node/service.js +11 -0
- package/dist/modules/index.d.ts +3 -0
- package/dist/modules/index.js +3 -0
- package/dist/modules/waitlist/action.d.ts +24 -0
- package/dist/modules/waitlist/action.js +29 -4
- package/dist/modules/waitlist/index.d.ts +1 -0
- package/dist/modules/waitlist/index.js +1 -0
- package/dist/modules/waitlist/schema.d.ts +14 -0
- package/dist/modules/waitlist/schema.js +6 -0
- package/dist/modules/waitlist/service.d.ts +4 -2
- package/dist/modules/waitlist/service.js +6 -0
- package/dist/modules/waitlist/types.d.ts +4 -0
- package/dist/services/chat-flow.d.ts +7 -0
- package/dist/services/chat-flow.js +25 -0
- package/dist/services/projects.d.ts +1 -1
- package/dist/services/users.d.ts +1 -1
- package/package.json +1 -1
- package/src/actions/index.ts +0 -1
- package/src/getSDKForCurrentUser.ts +9 -3
- package/src/getSDKForService.ts +52 -0
- package/src/index.ts +6 -6
- package/src/modules/account/actions.ts +21 -0
- package/src/modules/account/index.ts +3 -0
- package/src/modules/account/schema.ts +8 -0
- package/src/{services/account.ts → modules/account/service.ts} +61 -59
- package/src/modules/account/types.ts +426 -0
- package/src/modules/agent/action.ts +77 -0
- package/src/modules/agent/index.ts +4 -0
- package/src/modules/agent/schema.ts +25 -0
- package/src/modules/agent/service.ts +34 -0
- package/src/modules/agent/types.ts +15 -0
- package/src/modules/ai/index.ts +1 -0
- package/src/{actions/nodes.ts → modules/ai/node/actions.ts} +2 -2
- package/src/modules/ai/node/index.ts +2 -0
- package/src/{services/node.ts → modules/ai/node/service.ts} +4 -4
- package/src/modules/index.ts +4 -1
- package/src/modules/waitlist/action.ts +33 -4
- package/src/modules/waitlist/index.ts +2 -1
- package/src/modules/waitlist/schema.ts +9 -0
- package/src/modules/waitlist/service.ts +11 -2
- package/src/modules/waitlist/types.ts +5 -0
- package/src/services/chat-flow.ts +32 -0
- package/src/services/projects.ts +1 -1
- package/src/services/users.ts +1 -1
- /package/src/{enums → modules/account/enums}/authentication-factor.ts +0 -0
- /package/src/{enums → modules/account/enums}/authenticator-type.ts +0 -0
- /package/src/{enums → modules/account/enums}/o-auth-provider.ts +0 -0
@@ -0,0 +1,530 @@
|
|
1
|
+
import { AuthenticatorType } from './enums/authenticator-type';
|
2
|
+
import { AuthenticationFactor } from './enums/authentication-factor';
|
3
|
+
import { OAuthProvider } from './enums/o-auth-provider';
|
4
|
+
import { Client } from '../../client';
|
5
|
+
import { User, Preferences, IdentityList, Jwt, LogList, MfaType, MfaChallenge, MfaFactors, MfaRecoveryCodes, Token, SessionList, Session, Target } from './types';
|
6
|
+
export declare class Account {
|
7
|
+
client: Client;
|
8
|
+
constructor(client: Client);
|
9
|
+
/**
|
10
|
+
* Get account
|
11
|
+
*
|
12
|
+
* Get the currently logged in user.
|
13
|
+
*
|
14
|
+
* @throws {AppcondaException}
|
15
|
+
* @returns {Promise<Models.User<Preferences>>}
|
16
|
+
*/
|
17
|
+
get<T extends Preferences>(): Promise<User<T>>;
|
18
|
+
/**
|
19
|
+
* Create account
|
20
|
+
*
|
21
|
+
* 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://appconda.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://appconda.io/docs/references/cloud/client-web/account#createEmailSession).
|
22
|
+
*
|
23
|
+
* @param {string} userId
|
24
|
+
* @param {string} email
|
25
|
+
* @param {string} password
|
26
|
+
* @param {string} name
|
27
|
+
* @throws {AppcondaException}
|
28
|
+
* @returns {Promise<Models.User<Preferences>>}
|
29
|
+
*/
|
30
|
+
create<T extends Preferences>(userId: string, email: string, password: string, name?: string): Promise<User<T>>;
|
31
|
+
/**
|
32
|
+
* Delete account
|
33
|
+
*
|
34
|
+
* Delete the currently logged in user.
|
35
|
+
*
|
36
|
+
* @throws {AppcondaException}
|
37
|
+
* @returns {Promise<{}>}
|
38
|
+
*/
|
39
|
+
delete(): Promise<{}>;
|
40
|
+
/**
|
41
|
+
* Update email
|
42
|
+
*
|
43
|
+
* 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.
|
44
|
+
This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
|
45
|
+
|
46
|
+
*
|
47
|
+
* @param {string} email
|
48
|
+
* @param {string} password
|
49
|
+
* @throws {AppcondaException}
|
50
|
+
* @returns {Promise<Models.User<Preferences>>}
|
51
|
+
*/
|
52
|
+
updateEmail<T extends Preferences>(email: string, password: string): Promise<User<T>>;
|
53
|
+
/**
|
54
|
+
* List Identities
|
55
|
+
*
|
56
|
+
* Get the list of identities for the currently logged in user.
|
57
|
+
*
|
58
|
+
* @param {string[]} queries
|
59
|
+
* @throws {AppcondaException}
|
60
|
+
* @returns {Promise<IdentityList>}
|
61
|
+
*/
|
62
|
+
listIdentities(queries?: string[]): Promise<IdentityList>;
|
63
|
+
/**
|
64
|
+
* Delete identity
|
65
|
+
*
|
66
|
+
* Delete an identity by its unique ID.
|
67
|
+
*
|
68
|
+
* @param {string} identityId
|
69
|
+
* @throws {AppcondaException}
|
70
|
+
* @returns {Promise<{}>}
|
71
|
+
*/
|
72
|
+
deleteIdentity(identityId: string): Promise<{}>;
|
73
|
+
/**
|
74
|
+
* Create JWT
|
75
|
+
*
|
76
|
+
* 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 Appconda 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.
|
77
|
+
*
|
78
|
+
* @throws {AppcondaException}
|
79
|
+
* @returns {Promise<Jwt>}
|
80
|
+
*/
|
81
|
+
createJWT(): Promise<Jwt>;
|
82
|
+
/**
|
83
|
+
* List logs
|
84
|
+
*
|
85
|
+
* 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.
|
86
|
+
*
|
87
|
+
* @param {string[]} queries
|
88
|
+
* @throws {AppcondaException}
|
89
|
+
* @returns {Promise<LogList>}
|
90
|
+
*/
|
91
|
+
listLogs(queries?: string[]): Promise<LogList>;
|
92
|
+
/**
|
93
|
+
* Update MFA
|
94
|
+
*
|
95
|
+
* Enable or disable MFA on an account.
|
96
|
+
*
|
97
|
+
* @param {boolean} mfa
|
98
|
+
* @throws {AppcondaException}
|
99
|
+
* @returns {Promise<Models.User<Preferences>>}
|
100
|
+
*/
|
101
|
+
updateMFA<T extends Preferences>(mfa: boolean): Promise<User<T>>;
|
102
|
+
/**
|
103
|
+
* Create Authenticator
|
104
|
+
*
|
105
|
+
* 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.
|
106
|
+
*
|
107
|
+
* @param {AuthenticatorType} type
|
108
|
+
* @throws {AppcondaException}
|
109
|
+
* @returns {Promise<MfaType>}
|
110
|
+
*/
|
111
|
+
createMfaAuthenticator(type: AuthenticatorType): Promise<MfaType>;
|
112
|
+
/**
|
113
|
+
* Verify Authenticator
|
114
|
+
*
|
115
|
+
* Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
|
116
|
+
*
|
117
|
+
* @param {AuthenticatorType} type
|
118
|
+
* @param {string} otp
|
119
|
+
* @throws {AppcondaException}
|
120
|
+
* @returns {Promise<Models.User<Preferences>>}
|
121
|
+
*/
|
122
|
+
updateMfaAuthenticator<T extends Preferences>(type: AuthenticatorType, otp: string): Promise<User<T>>;
|
123
|
+
/**
|
124
|
+
* Delete Authenticator
|
125
|
+
*
|
126
|
+
* Delete an authenticator for a user by ID.
|
127
|
+
*
|
128
|
+
* @param {AuthenticatorType} type
|
129
|
+
* @throws {AppcondaException}
|
130
|
+
* @returns {Promise<{}>}
|
131
|
+
*/
|
132
|
+
deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}>;
|
133
|
+
/**
|
134
|
+
* Create MFA Challenge
|
135
|
+
*
|
136
|
+
* Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
|
137
|
+
*
|
138
|
+
* @param {AuthenticationFactor} factor
|
139
|
+
* @throws {AppcondaException}
|
140
|
+
* @returns {Promise<MfaChallenge>}
|
141
|
+
*/
|
142
|
+
createMfaChallenge(factor: AuthenticationFactor): Promise<MfaChallenge>;
|
143
|
+
/**
|
144
|
+
* Create MFA Challenge (confirmation)
|
145
|
+
*
|
146
|
+
* 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.
|
147
|
+
*
|
148
|
+
* @param {string} challengeId
|
149
|
+
* @param {string} otp
|
150
|
+
* @throws {AppcondaException}
|
151
|
+
* @returns {Promise<{}>}
|
152
|
+
*/
|
153
|
+
updateMfaChallenge(challengeId: string, otp: string): Promise<{}>;
|
154
|
+
/**
|
155
|
+
* List Factors
|
156
|
+
*
|
157
|
+
* List the factors available on the account to be used as a MFA challange.
|
158
|
+
*
|
159
|
+
* @throws {AppcondaException}
|
160
|
+
* @returns {Promise<MfaFactors>}
|
161
|
+
*/
|
162
|
+
listMfaFactors(): Promise<MfaFactors>;
|
163
|
+
/**
|
164
|
+
* Get MFA Recovery Codes
|
165
|
+
*
|
166
|
+
* 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.
|
167
|
+
*
|
168
|
+
* @throws {AppcondaException}
|
169
|
+
* @returns {Promise<MfaRecoveryCodes>}
|
170
|
+
*/
|
171
|
+
getMfaRecoveryCodes(): Promise<MfaRecoveryCodes>;
|
172
|
+
/**
|
173
|
+
* Create MFA Recovery Codes
|
174
|
+
*
|
175
|
+
* 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.
|
176
|
+
*
|
177
|
+
* @throws {AppcondaException}
|
178
|
+
* @returns {Promise<Models.MfaRecoveryCodes>}
|
179
|
+
*/
|
180
|
+
createMfaRecoveryCodes(): Promise<MfaRecoveryCodes>;
|
181
|
+
/**
|
182
|
+
* Regenerate MFA Recovery Codes
|
183
|
+
*
|
184
|
+
* 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.
|
185
|
+
*
|
186
|
+
* @throws {AppcondaException}
|
187
|
+
* @returns {Promise<Models.MfaRecoveryCodes>}
|
188
|
+
*/
|
189
|
+
updateMfaRecoveryCodes(): Promise<MfaRecoveryCodes>;
|
190
|
+
/**
|
191
|
+
* Update name
|
192
|
+
*
|
193
|
+
* Update currently logged in user account name.
|
194
|
+
*
|
195
|
+
* @param {string} name
|
196
|
+
* @throws {AppcondaException}
|
197
|
+
* @returns {Promise<Models.User<Preferences>>}
|
198
|
+
*/
|
199
|
+
updateName<T extends Preferences>(name: string): Promise<User<T>>;
|
200
|
+
/**
|
201
|
+
* Update password
|
202
|
+
*
|
203
|
+
* 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.
|
204
|
+
*
|
205
|
+
* @param {string} password
|
206
|
+
* @param {string} oldPassword
|
207
|
+
* @throws {AppcondaException}
|
208
|
+
* @returns {Promise<Models.User<Preferences>>}
|
209
|
+
*/
|
210
|
+
updatePassword<T extends Preferences>(password: string, oldPassword?: string): Promise<User<T>>;
|
211
|
+
/**
|
212
|
+
* Update phone
|
213
|
+
*
|
214
|
+
* 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://appconda.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.
|
215
|
+
*
|
216
|
+
* @param {string} phone
|
217
|
+
* @param {string} password
|
218
|
+
* @throws {AppcondaException}
|
219
|
+
* @returns {Promise<Models.User<Preferences>>}
|
220
|
+
*/
|
221
|
+
updatePhone<T extends Preferences>(phone: string, password: string): Promise<User<T>>;
|
222
|
+
/**
|
223
|
+
* Get account preferences
|
224
|
+
*
|
225
|
+
* Get the preferences as a key-value object for the currently logged in user.
|
226
|
+
*
|
227
|
+
* @throws {AppcondaException}
|
228
|
+
* @returns {Promise<Preferences>}
|
229
|
+
*/
|
230
|
+
getPrefs<T extends Preferences>(): Promise<T>;
|
231
|
+
/**
|
232
|
+
* Update preferences
|
233
|
+
*
|
234
|
+
* 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.
|
235
|
+
*
|
236
|
+
* @param {Partial<Preferences>} prefs
|
237
|
+
* @throws {AppcondaException}
|
238
|
+
* @returns {Promise<Models.User<Preferences>>}
|
239
|
+
*/
|
240
|
+
updatePrefs<T extends Preferences>(prefs: Partial<Preferences>): Promise<User<T>>;
|
241
|
+
/**
|
242
|
+
* Create password recovery
|
243
|
+
*
|
244
|
+
* 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://appconda.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.
|
245
|
+
*
|
246
|
+
* @param {string} email
|
247
|
+
* @param {string} url
|
248
|
+
* @throws {AppcondaException}
|
249
|
+
* @returns {Promise<Token>}
|
250
|
+
*/
|
251
|
+
createRecovery(email: string, url: string): Promise<Token>;
|
252
|
+
/**
|
253
|
+
* Create password recovery (confirmation)
|
254
|
+
*
|
255
|
+
* 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://appconda.io/docs/references/cloud/client-web/account#createRecovery) endpoint.
|
256
|
+
|
257
|
+
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.
|
258
|
+
*
|
259
|
+
* @param {string} userId
|
260
|
+
* @param {string} secret
|
261
|
+
* @param {string} password
|
262
|
+
* @throws {AppcondaException}
|
263
|
+
* @returns {Promise<Models.Token>}
|
264
|
+
*/
|
265
|
+
updateRecovery(userId: string, secret: string, password: string): Promise<Token>;
|
266
|
+
/**
|
267
|
+
* List sessions
|
268
|
+
*
|
269
|
+
* Get the list of active sessions across different devices for the currently logged in user.
|
270
|
+
*
|
271
|
+
* @throws {AppcondaException}
|
272
|
+
* @returns {Promise<SessionList>}
|
273
|
+
*/
|
274
|
+
listSessions(): Promise<SessionList>;
|
275
|
+
/**
|
276
|
+
* Delete sessions
|
277
|
+
*
|
278
|
+
* Delete all sessions from the user account and remove any sessions cookies from the end client.
|
279
|
+
*
|
280
|
+
* @throws {AppcondaException}
|
281
|
+
* @returns {Promise<{}>}
|
282
|
+
*/
|
283
|
+
deleteSessions(): Promise<{}>;
|
284
|
+
/**
|
285
|
+
* Create anonymous session
|
286
|
+
*
|
287
|
+
* 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](https://appconda.io/docs/references/cloud/client-web/account#updateEmail) or create an [OAuth2 session](https://appconda.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
|
288
|
+
*
|
289
|
+
* @throws {AppcondaException}
|
290
|
+
* @returns {Promise<Models.Session>}
|
291
|
+
*/
|
292
|
+
createAnonymousSession(): Promise<Session>;
|
293
|
+
/**
|
294
|
+
* Create email password session
|
295
|
+
*
|
296
|
+
* 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.
|
297
|
+
|
298
|
+
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appconda.io/docs/authentication-security#limits).
|
299
|
+
*
|
300
|
+
* @param {string} email
|
301
|
+
* @param {string} password
|
302
|
+
* @throws {AppcondaException}
|
303
|
+
* @returns {Promise<Session>}
|
304
|
+
*/
|
305
|
+
createEmailPasswordSession(email: string, password: string): Promise<Session>;
|
306
|
+
/**
|
307
|
+
* Update magic URL session
|
308
|
+
*
|
309
|
+
* 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.
|
310
|
+
*
|
311
|
+
* @param {string} userId
|
312
|
+
* @param {string} secret
|
313
|
+
* @throws {AppcondaException}
|
314
|
+
* @returns {Promise<Models.Session>}
|
315
|
+
*/
|
316
|
+
updateMagicURLSession(userId: string, secret: string): Promise<Session>;
|
317
|
+
/**
|
318
|
+
* Create OAuth2 session
|
319
|
+
*
|
320
|
+
* Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appconda console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
|
321
|
+
|
322
|
+
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 email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user.
|
323
|
+
|
324
|
+
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appconda.io/docs/authentication-security#limits).
|
325
|
+
|
326
|
+
*
|
327
|
+
* @param {OAuthProvider} provider
|
328
|
+
* @param {string} success
|
329
|
+
* @param {string} failure
|
330
|
+
* @param {string[]} scopes
|
331
|
+
* @throws {AppcondaException}
|
332
|
+
* @returns {Promise<void | string>}
|
333
|
+
*/
|
334
|
+
createOAuth2Session(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): Promise<void | string>;
|
335
|
+
/**
|
336
|
+
* Update phone session
|
337
|
+
*
|
338
|
+
* 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.
|
339
|
+
*
|
340
|
+
* @param {string} userId
|
341
|
+
* @param {string} secret
|
342
|
+
* @throws {AppcondaException}
|
343
|
+
* @returns {Promise<Models.Session>}
|
344
|
+
*/
|
345
|
+
updatePhoneSession(userId: string, secret: string): Promise<Session>;
|
346
|
+
/**
|
347
|
+
* Create session
|
348
|
+
*
|
349
|
+
* 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.
|
350
|
+
*
|
351
|
+
* @param {string} userId
|
352
|
+
* @param {string} secret
|
353
|
+
* @throws {AppcondaException}
|
354
|
+
* @returns {Promise<Models.Session>}
|
355
|
+
*/
|
356
|
+
createSession(userId: string, secret: string): Promise<Session>;
|
357
|
+
/**
|
358
|
+
* Get session
|
359
|
+
*
|
360
|
+
* Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.
|
361
|
+
*
|
362
|
+
* @param {string} sessionId
|
363
|
+
* @throws {AppcondaException}
|
364
|
+
* @returns {Promise<Models.Session>}
|
365
|
+
*/
|
366
|
+
getSession(sessionId: string): Promise<Session>;
|
367
|
+
/**
|
368
|
+
* Update session
|
369
|
+
*
|
370
|
+
* 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.
|
371
|
+
*
|
372
|
+
* @param {string} sessionId
|
373
|
+
* @throws {AppcondaException}
|
374
|
+
* @returns {Promise<Models.Session>}
|
375
|
+
*/
|
376
|
+
updateSession(sessionId: string): Promise<Session>;
|
377
|
+
/**
|
378
|
+
* Delete session
|
379
|
+
*
|
380
|
+
* 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://appconda.io/docs/references/cloud/client-web/account#deleteSessions) instead.
|
381
|
+
*
|
382
|
+
* @param {string} sessionId
|
383
|
+
* @throws {AppcondaException}
|
384
|
+
* @returns {Promise<{}>}
|
385
|
+
*/
|
386
|
+
deleteSession(sessionId: string): Promise<{}>;
|
387
|
+
/**
|
388
|
+
* Update status
|
389
|
+
*
|
390
|
+
* 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.
|
391
|
+
*
|
392
|
+
* @throws {AppcondaException}
|
393
|
+
* @returns {Promise<Models.User<Preferences>>}
|
394
|
+
*/
|
395
|
+
updateStatus<T extends Preferences>(): Promise<User<T>>;
|
396
|
+
/**
|
397
|
+
* Create push target
|
398
|
+
*
|
399
|
+
*
|
400
|
+
* @param {string} targetId
|
401
|
+
* @param {string} identifier
|
402
|
+
* @param {string} providerId
|
403
|
+
* @throws {AppcondaException}
|
404
|
+
* @returns {Promise<Target>}
|
405
|
+
*/
|
406
|
+
createPushTarget(targetId: string, identifier: string, providerId?: string): Promise<Target>;
|
407
|
+
/**
|
408
|
+
* Update push target
|
409
|
+
*
|
410
|
+
*
|
411
|
+
* @param {string} targetId
|
412
|
+
* @param {string} identifier
|
413
|
+
* @throws {AppcondaException}
|
414
|
+
* @returns {Promise<Target>}
|
415
|
+
*/
|
416
|
+
updatePushTarget(targetId: string, identifier: string): Promise<Target>;
|
417
|
+
/**
|
418
|
+
* Delete push target
|
419
|
+
*
|
420
|
+
*
|
421
|
+
* @param {string} targetId
|
422
|
+
* @throws {AppcondaException}
|
423
|
+
* @returns {Promise<{}>}
|
424
|
+
*/
|
425
|
+
deletePushTarget(targetId: string): Promise<{}>;
|
426
|
+
/**
|
427
|
+
* Create email token (OTP)
|
428
|
+
*
|
429
|
+
* Sends the user an email 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://appconda.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.
|
430
|
+
|
431
|
+
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appconda.io/docs/authentication-security#limits).
|
432
|
+
*
|
433
|
+
* @param {string} userId
|
434
|
+
* @param {string} email
|
435
|
+
* @param {boolean} phrase
|
436
|
+
* @throws {AppcondaException}
|
437
|
+
* @returns {Promise<Models.Token>}
|
438
|
+
*/
|
439
|
+
createEmailToken(userId: string, email: string, phrase?: boolean): Promise<Token>;
|
440
|
+
/**
|
441
|
+
* Create magic URL token
|
442
|
+
*
|
443
|
+
* 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://appconda.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. If you are on a mobile device you can leave the URL parameter empty, so that the login completion will be handled by your Appconda instance by default.
|
444
|
+
|
445
|
+
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appconda.io/docs/authentication-security#limits).
|
446
|
+
|
447
|
+
*
|
448
|
+
* @param {string} userId
|
449
|
+
* @param {string} email
|
450
|
+
* @param {string} url
|
451
|
+
* @param {boolean} phrase
|
452
|
+
* @throws {AppcondaException}
|
453
|
+
* @returns {Promise<Models.Token>}
|
454
|
+
*/
|
455
|
+
createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise<Token>;
|
456
|
+
/**
|
457
|
+
* Create OAuth2 token
|
458
|
+
*
|
459
|
+
* Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appconda console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
|
460
|
+
|
461
|
+
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://appconda.io/docs/references/cloud/client-web/account#createSession) endpoint.
|
462
|
+
|
463
|
+
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appconda.io/docs/authentication-security#limits).
|
464
|
+
*
|
465
|
+
* @param {OAuthProvider} provider
|
466
|
+
* @param {string} success
|
467
|
+
* @param {string} failure
|
468
|
+
* @param {string[]} scopes
|
469
|
+
* @throws {AppcondaException}
|
470
|
+
* @returns {Promise<void | string>}
|
471
|
+
*/
|
472
|
+
createOAuth2Token(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): Promise<void | string>;
|
473
|
+
/**
|
474
|
+
* Create phone token
|
475
|
+
*
|
476
|
+
* 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://appconda.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.
|
477
|
+
|
478
|
+
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appconda.io/docs/authentication-security#limits).
|
479
|
+
*
|
480
|
+
* @param {string} userId
|
481
|
+
* @param {string} phone
|
482
|
+
* @throws {AppcondaException}
|
483
|
+
* @returns {Promise<Models.Token>}
|
484
|
+
*/
|
485
|
+
createPhoneToken(userId: string, phone: string): Promise<Token>;
|
486
|
+
/**
|
487
|
+
* Create email verification
|
488
|
+
*
|
489
|
+
* 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://appconda.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
|
490
|
+
|
491
|
+
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.
|
492
|
+
|
493
|
+
*
|
494
|
+
* @param {string} url
|
495
|
+
* @throws {AppcondaException}
|
496
|
+
* @returns {Promise<Models.Token>}
|
497
|
+
*/
|
498
|
+
createVerification(url: string): Promise<Token>;
|
499
|
+
/**
|
500
|
+
* Create email verification (confirmation)
|
501
|
+
*
|
502
|
+
* 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.
|
503
|
+
*
|
504
|
+
* @param {string} userId
|
505
|
+
* @param {string} secret
|
506
|
+
* @throws {AppcondaException}
|
507
|
+
* @returns {Promise<Models.Token>}
|
508
|
+
*/
|
509
|
+
updateVerification(userId: string, secret: string): Promise<Token>;
|
510
|
+
/**
|
511
|
+
* Create phone verification
|
512
|
+
*
|
513
|
+
* 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://appconda.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appconda.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes.
|
514
|
+
*
|
515
|
+
* @throws {AppcondaException}
|
516
|
+
* @returns {Promise<Models.Token>}
|
517
|
+
*/
|
518
|
+
createPhoneVerification(): Promise<Token>;
|
519
|
+
/**
|
520
|
+
* Update phone verification (confirmation)
|
521
|
+
*
|
522
|
+
* 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.
|
523
|
+
*
|
524
|
+
* @param {string} userId
|
525
|
+
* @param {string} secret
|
526
|
+
* @throws {AppcondaException}
|
527
|
+
* @returns {Promise<Models.Token>}
|
528
|
+
*/
|
529
|
+
updatePhoneVerification(userId: string, secret: string): Promise<Token>;
|
530
|
+
}
|