Skip to main content

Type Alias: SignIn()

SignIn = (email, password, customerId?) => Promise<Nullable<UserData | AuthError>>

Signs in a user with the provided credentials. Authenticates the user against the specified customer and returns user data upon success.

Parameters

email

string

The username (email) to be signed in

password

string

The password of the username

customerId?

Nullable<string>

ID of customer we want to sign in (optional)

Returns

Promise<Nullable<UserData | AuthError>>

A promise that resolves to UserData on success or AuthError on failure

Example

window.mimeeqAuth.authorization.signIn('[email protected]', 'password123', 'customer123')
.then(result => {
if ('name' in result) {
// Handle error
console.error(`Sign-in failed: ${result.message}`);
} else {
// Handle successful sign-in
console.log(`Welcome, ${result.firstName}!`);
}
});

Fires

@mimeeq#mimeeq-user-signed-in