Skip to content

Commit 35617a8

Browse files
fix: mfa methods
1 parent b19a0bc commit 35617a8

File tree

97 files changed

+1139
-815
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1139
-815
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { Client, Account } from "appwrite";
3333
To install with a CDN (content delivery network) add the following scripts to the bottom of your <body> tag, but before you use any Appwrite services:
3434

3535
```html
36-
<script src="https://cdn.jsdelivr.net/npm/[email protected].4"></script>
36+
<script src="https://cdn.jsdelivr.net/npm/[email protected].5"></script>
3737
```
3838

3939

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
import { Client, Account, AuthenticatorType } from "appwrite";
1+
import { Client, AuthenticatorType, Account } from "appwrite";
22

3-
const client = new Client()
4-
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5-
.setProject('5df5acd0d48c2'); // Your project ID
3+
const client = new Client();
64

75
const account = new Account(client);
86

9-
const result = await account.addAuthenticator(
10-
AuthenticatorType.Totp // type
11-
);
7+
client
8+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9+
.setProject('5df5acd0d48c2') // Your project ID
10+
;
11+
12+
const promise = account.addAuthenticator(AuthenticatorType.Totp);
1213

13-
console.log(response);
14+
promise.then(function (response) {
15+
console.log(response); // Success
16+
}, function (error) {
17+
console.log(error); // Failure
18+
});
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
import { Client, Account } from "appwrite";
1+
import { Client, Account } from "appwrite";
22

3-
const client = new Client()
4-
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5-
.setProject('5df5acd0d48c2'); // Your project ID
3+
const client = new Client();
64

75
const account = new Account(client);
86

9-
const result = await account.createAnonymousSession();
7+
client
8+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9+
.setProject('5df5acd0d48c2') // Your project ID
10+
;
11+
12+
const promise = account.createAnonymousSession();
1013

11-
console.log(response);
14+
promise.then(function (response) {
15+
console.log(response); // Success
16+
}, function (error) {
17+
console.log(error); // Failure
18+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Client, , Account } from "appwrite";
2+
3+
const client = new Client();
4+
5+
const account = new Account(client);
6+
7+
client
8+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9+
.setProject('5df5acd0d48c2') // Your project ID
10+
;
11+
12+
const promise = account.createChallenge(.Totp);
13+
14+
promise.then(function (response) {
15+
console.log(response); // Success
16+
}, function (error) {
17+
console.log(error); // Failure
18+
});
Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
import { Client, Account } from "appwrite";
1+
import { Client, Account } from "appwrite";
22

3-
const client = new Client()
4-
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5-
.setProject('5df5acd0d48c2'); // Your project ID
3+
const client = new Client();
64

75
const account = new Account(client);
86

9-
const result = await account.createEmailPasswordSession(
10-
'[email protected]', // email
11-
'password' // password
12-
);
7+
client
8+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9+
.setProject('5df5acd0d48c2') // Your project ID
10+
;
11+
12+
const promise = account.createEmailPasswordSession('[email protected]', 'password');
1313

14-
console.log(response);
14+
promise.then(function (response) {
15+
console.log(response); // Success
16+
}, function (error) {
17+
console.log(error); // Failure
18+
});
Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
import { Client, Account } from "appwrite";
1+
import { Client, Account } from "appwrite";
22

3-
const client = new Client()
4-
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5-
.setProject('5df5acd0d48c2'); // Your project ID
3+
const client = new Client();
64

75
const account = new Account(client);
86

9-
const result = await account.createEmailToken(
10-
'[USER_ID]', // userId
11-
'[email protected]', // email
12-
false // phrase (optional)
13-
);
7+
client
8+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9+
.setProject('5df5acd0d48c2') // Your project ID
10+
;
11+
12+
const promise = account.createEmailToken('[USER_ID]', '[email protected]');
1413

15-
console.log(response);
14+
promise.then(function (response) {
15+
console.log(response); // Success
16+
}, function (error) {
17+
console.log(error); // Failure
18+
});
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
import { Client, Account } from "appwrite";
1+
import { Client, Account } from "appwrite";
22

3-
const client = new Client()
4-
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5-
.setProject('5df5acd0d48c2'); // Your project ID
3+
const client = new Client();
64

75
const account = new Account(client);
86

9-
const result = await account.createJWT();
7+
client
8+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9+
.setProject('5df5acd0d48c2') // Your project ID
10+
;
11+
12+
const promise = account.createJWT();
1013

11-
console.log(response);
14+
promise.then(function (response) {
15+
console.log(response); // Success
16+
}, function (error) {
17+
console.log(error); // Failure
18+
});
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
import { Client, Account } from "appwrite";
1+
import { Client, Account } from "appwrite";
22

3-
const client = new Client()
4-
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5-
.setProject('5df5acd0d48c2'); // Your project ID
3+
const client = new Client();
64

75
const account = new Account(client);
86

9-
const result = await account.createMagicURLToken(
10-
'[USER_ID]', // userId
11-
'[email protected]', // email
12-
'https://example.com', // url (optional)
13-
false // phrase (optional)
14-
);
7+
client
8+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9+
.setProject('5df5acd0d48c2') // Your project ID
10+
;
11+
12+
const promise = account.createMagicURLToken('[USER_ID]', '[email protected]');
1513

16-
console.log(response);
14+
promise.then(function (response) {
15+
console.log(response); // Success
16+
}, function (error) {
17+
console.log(error); // Failure
18+
});
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
import { Client, Account, OAuthProvider } from "appwrite";
1+
import { Client, OAuthProvider, Account } from "appwrite";
22

3-
const client = new Client()
4-
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5-
.setProject('5df5acd0d48c2'); // Your project ID
3+
const client = new Client();
64

75
const account = new Account(client);
86

9-
account.createOAuth2Session(
10-
OAuthProvider.Amazon, // provider
11-
'https://example.com', // success (optional)
12-
'https://example.com', // failure (optional)
13-
false, // token (optional)
14-
[] // scopes (optional)
15-
);
7+
client
8+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9+
.setProject('5df5acd0d48c2') // Your project ID
10+
;
11+
12+
// Go to OAuth provider login page
13+
account.createOAuth2Session(OAuthProvider.Amazon);
1614

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
import { Client, Account } from "appwrite";
1+
import { Client, Account } from "appwrite";
22

3-
const client = new Client()
4-
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
5-
.setProject('5df5acd0d48c2'); // Your project ID
3+
const client = new Client();
64

75
const account = new Account(client);
86

9-
const result = await account.createPhoneToken(
10-
'[USER_ID]', // userId
11-
'+12065550100' // phone
12-
);
7+
client
8+
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
9+
.setProject('5df5acd0d48c2') // Your project ID
10+
;
11+
12+
const promise = account.createPhoneToken('[USER_ID]', '+12065550100');
1313

14-
console.log(response);
14+
promise.then(function (response) {
15+
console.log(response); // Success
16+
}, function (error) {
17+
console.log(error); // Failure
18+
});

0 commit comments

Comments
 (0)