Authentication
Sign In with Email and Password
Learn about Email and Password
Sign In with Email and Password is enabled by default on all projects.
Sign Up
To Sign Up a new user, use signUp
with a valid email and password.
await nhost.auth.signUp({
email: 'joe@example.com',
password: 'secret-password'
})
When email verification is enabled, a newly registered user will receive an email with a link they must follow in order to verify the email address
Sign In
After a user is registered, and optionally verified, it is able to Sign In.
await nhost.auth.signIn({
email: 'joe@example.com',
password: 'secret-password'
})
Email Verification
By default, newly registered users will receive an email with a verification link they must follow before they can Sign In.
To change this setting, navigate to Settings -> Sign-In Methods -> Email and Password and set Require Verified Emails.
It is possible to manually send the verification email to a user with sendVerificationEmail()
.
await nhost.auth.sendVerificationEmail({
email: 'joe@example.com',
password: 'secret-password'
})
It is possible to customize these automatic emails, learn how to here