signIn
Sign in to your Aura app with a built-in or custom OAuth provider.
The signIn client function is the primary programmatic entry point for initiating an authentication flow with any configured OAuth 2.0 or OpenID Connect (OIDC) provider, from a client-side or browser context.
import { authClient } from "@/lib/auth-client"
const output = await authClient.signIn("google", {
redirectTo: "/dashboard",
})Reference
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| providerId | string | Yes | The id of the OAuth provider to use for sign-in. |
| options | SignInOptions | No | An object containing additional options for the sign-in process. |
SignInOptions
| Option | Type | Default | Description |
|---|---|---|---|
| redirect | boolean | false | Whether to redirect via window.location.assign (true) or return the result as an object (false). |
| redirectTo | string | undefined | The URL to redirect to after a successful sign-in. |
redirect defaults to false here — unlike the other client methods, which default to true. This is intentional: signIn
navigates the browser to a cross-origin OAuth provider URL, and doing that via a Location header on a fetch() response
runs into CORS restrictions on cross-origin redirects. To avoid that, the client resolves the authorize URL and navigates
manually with window.location.assign, which requires you to opt in or handle the navigation yourself.
Returns
| Return Type | Description |
|---|---|
Promise<SignInReturn<Options>> | Resolves to an object containing signInURL, redirect, and success — see Behavior below. |
Behavior
- Cookies are set automatically in the browser context — you don't need to handle them manually.
- The return value depends on the
redirectoption:redirect: false(default) — resolves to an object withsignInURL,redirect: false, andsuccess, letting you handle navigation yourself.redirect: true— the client navigates the browser to the OAuth provider's authorize URL viawindow.location.assign. Nothing meaningful is returned to inspect programmatically; the navigation itself is the result.
- If sign-in fails to initiate (e.g. an unknown
providerId),signInURLresolves tonullandsuccessisfalse.
Usage
Social login
import { authClient } from "@/lib/auth-client"
const output = await authClient.signIn("github", {
redirect: true,
redirectTo: "/dashboard",
})Manual navigation
import { authClient } from "@/lib/auth-client"
const output = await authClient.signIn("google")
if (output.success) {
window.location.assign(output.signInURL)
}functions
The functions exposed by createAuthClient — sign-in, sign-up, session management, OAuth token management, and sign-out for client-side and browser contexts.
signInCredentials
Sign in to your Aura Auth app using a username or email and password. This is a built-in credential provider that can be used in addition to OAuth providers.