Skip to content

Commit 70918ed

Browse files
authored
docs(password-client): add example of login with password (#1033)
1 parent f884146 commit 70918ed

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

website/docs/strategies/password-client.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,23 @@ Create a new account for the user.
3939

4040
```javascript
4141
await accountsPassword.createUser({
42-
email: user.email,
43-
password: user.password,
42+
email: 'userEmail',
43+
password: 'userPassword',
4444
// You can also add some custom fields
4545
});
4646
```
4747

48+
### Login user
49+
50+
```javascript
51+
const user = await accountsClient.loginWithService('password', {
52+
user: {
53+
email: 'userEmail',
54+
},
55+
password: 'userPassword',
56+
});
57+
```
58+
4859
### Change password
4960

5061
Change the current user's password. Must be logged in.
@@ -60,6 +71,7 @@ In order to reset a user password, the first step is to send an email to the use
6071
```javascript
6172
// Request a forgot password email
6273
await accountsPassword.requestPasswordReset('email');
74+
6375
// Reset the password for a user using a token received in email
6476
await accountsPassword.resetPassword('token', 'newPassword');
6577
```
@@ -71,6 +83,7 @@ When a user is created, their email will be marked as unverified. To verify the
7183
```javascript
7284
// Send an email with a link the user can use verify their email address.
7385
await accountsPassword.requestVerificationEmail('email');
86+
7487
// Marks the user's email address as verified using a token received in email
7588
await accountsPassword.verifyEmail('token');
7689
```

0 commit comments

Comments
 (0)