Skip to content

signIn()

Use nhost.auth.signIn to sign in a user using email and password, passwordless (email or sms) or an external provider. signIn can be used to sign in a user in various ways depending on the parameters.

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

params optional SignInParams


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

Sign in a user using an OAuth provider (e.g: Google or Facebook)

Section titled “Sign in a user using an OAuth provider (e.g: Google or Facebook)”
nhost.auth.signIn({ provider: 'google' })
Section titled “Sign in a user using passwordless email (Magic Link)”
nhost.auth.signIn({ email: 'joe@example.com' })
// [step 1/2] Passwordless sign in using SMS
nhost.auth.signIn({ phoneNumber: '+11233213123' })
// [step 2/2] Finish passwordless sign in using SMS (OTP)
nhost.auth.signIn({ phoneNumber: '+11233213123', otp: '123456' })
// Sign in anonymously
nhost.auth.signIn()
// Later in the application, the user can complete their registration
nhost.auth.signUp({
email: 'joe@example.com',
password: 'secret-password'
})
nhost.auth.signIn({
email: 'joe@example.com',
securityKey: true
})
@docs https://docs.nhost.io/reference/deprecated/javascript/auth/sign-in