Skip to main content

Sign In with Email and Password

Follow this guide to sign in users with email and password.

The email and password sign-in method is enabled by default for all Nhost apps.

Sign Up

Users must first sign up to be able to sign in with Email and Password.

Example: Sign up users using the Nhost JavaScript client.

await nhost.auth.signUp({
email: 'joe@example.com',
password: 'secret-password'
})

If you've turned on email verification in your app's Authentication Settings, a user will be sent a verification email upon signup. The user must click the verification link in the email before they can sign in.

Sign In

Once a user has been signed up (and optionally verified), you can sign them in.

Example: Sign in users using the Nhost JavaScript client.

await nhost.auth.signIn({
email: 'joe@example.com',
password: 'secret-password'
})

Verified Emails

You can decide if only verified emails should be able to sign in or not. Modify the Only allow login for verified emails. setting in the Authentication Settings section under Users in your Nhost app.

An email-verification email is automatically sent to the user during sign-up if your app only allows to sign in users with verified emails. You can also manually send the verification email to the user using nhost.auth.sendVerificationEmail().