<AuthView /> component
The <AuthView /> component renders a complete native authentication interface using SwiftUI on iOS and Jetpack Compose on Android. It handles all authentication flows including email, phone, OAuth, passkeys, and multi-factor authentication. All methods enabled in your Clerk Dashboard are automatically supported.
Usage
The following examples show how to use the <AuthView /> in your Expo app. Use useAuth() or useUser() in a useEffect to react to authentication state changes.
Basic usage
import { AuthView } from '@clerk/expo/native'
import { useAuth } from '@clerk/expo'
import { useRouter } from 'expo-router'
import { useEffect } from 'react'
export default function SignInScreen() {
const { isSignedIn } = useAuth({ treatPendingAsSignedOut: false })
const router = useRouter()
useEffect(() => {
if (isSignedIn) {
router.replace('/(home)')
}
}, [isSignedIn])
return <AuthView mode="signInOrUp" />
}<AuthView mode="signIn" /><AuthView mode="signUp" />- Name
mode- Type
'signIn' | 'signUp' | 'signInOrUp'- Description
The authentication mode that determines which flows are available to the user. Defaults to
'signInOrUp'.'signIn'- Restricts the interface to sign-in flows only. Users can only authenticate with existing accounts.'signUp'- Restricts the interface to sign-up flows only. Users can only create new accounts.'signInOrUp'- Automatically determines whether to sign users in or sign them up based on whether they already have an account. This is the default mode that provides seamless authentication without requiring users to choose between sign-in and sign-up.
- Name
isDismissable- Type
boolean- Description
Whether the authentication view can be dismissed by the user. When
true, a dismiss button appears. Whenfalse, no dismiss button is shown. Defaults tofalse.
Social connection (OAuth) configuration
<AuthView /> automatically shows sign-in buttons for any social connections enabled in your Clerk Dashboard. However, native OAuth requires additional credential setup — without it, the buttons will appear but fail with an error when tapped.
Sign in with Google
Follow the steps in the Sign in with Google guide to complete the following:
- Enable Google as a social connection with Use custom credentials toggled on.
- Create OAuth 2.0 credentials in the Google Cloud Console — you'll need an iOS Client ID, Android Client ID, and Web Client ID.
- Set the Web Client ID and Client Secret in the Clerk Dashboard.
- Add your iOS application to the Native Applications page in the Clerk Dashboard (Team ID + Bundle ID).
- Add your Android application to the Native Applications page in the Clerk Dashboard (package name).
- Add the Google Client IDs as environment variables in your
.envfile. Follow the.env.examplein the Sign in with Google guide. - Configure the
@clerk/expoplugin with the iOS URL scheme in yourapp.json.
Sign in with Apple
Follow the steps in the Sign in with Apple guide to complete the following:
- Add your iOS application to the Native Applications page in the Clerk Dashboard (Team ID + Bundle ID).
- Enable Apple as a social connection in the Clerk Dashboard.
Feedback
Last updated on