Search...
login( )
Logs a registered member in with an email and password.
Description
The login()
function returns a Promise that resolves when the member with
the specified email address and password is logged in.
The login()
function only works with existing members. To register a new member use
the register()
function.
Note:
- The APIs in
wix-members-frontend
are only partially functional when previewing your site. View a published version of your site to see their complete functionality.
Syntax
function login(email: string, password: string): Promise<void>
login Parameters
NAME
TYPE
DESCRIPTION
email
string
Login email address.
password
string
Member password.
Returns
Fulfilled - When the member is logged in. Rejected - Error message.
Return Type:
Promise<void>
Was this helpful?
Log a member in
Copy Code
1import { authentication } from 'wix-members-frontend';23// ...45authentication.login(email, password)6 .then(() => {7 console.log('Member is logged in');8 })9 .catch((error) => {10 console.error(error);11 });
Log a member in using data from input elements
Copy Code
1import { authentication } from 'wix-members-frontend';23// ...45$w('#login').onClick(async () => {6 const email = $w('#email').value;7 const password = $w('#password').value;89 try {10 await authentication.login(email, password);11 console.log('Member is logged in');12 } catch (error) {13 console.error(error);14 }15});