Skip to main content

Build your own sign-in-or-up page for your Expo web app

This guide shows you how to use the <SignIn /> prebuilt component in order to build custom page that allows users to sign in or sign up within a single flow.

To set up separate sign-in and sign-up pages, follow this guide, and then follow the custom sign-up page guide.

This guide uses Expo Router and platform-specific extensions to build a sign-in-or-up page for the web. Expo Router requires a non-platform route alongside a platform-specific route, so create both files shown below.

Build a sign-in-or-up page

Create both files in the following structure:

src/
└── app/
    ├── sign-in.tsx
    └── sign-in.web.tsx

The non-platform file renders the native <AuthView />Expo Icon. Because <AuthView /> doesn't navigate on its own, the example watches the session and redirects once authentication completes. The .web.tsx file renders the web <SignIn /> component, which allows users to sign in or sign up from a single flow.

src/app/sign-in.tsx
import { AuthView } from '@clerk/expo/native'
import { useSession } from '@clerk/expo'
import { useRouter } from 'expo-router'
import { useEffect } from 'react'

export default function Page() {
  const { session } = useSession()
  const router = useRouter()

  useEffect(() => {
    if (session?.status === 'active') {
      router.replace('/')
    }
  }, [session?.status, router])

  return <AuthView isDismissible={false} />
}
src/app/sign-in.web.tsx
import { SignIn } from '@clerk/expo/web'

export default function Page() {
  return <SignIn />
}

Visit your new page

To run your project, use the following command:

npm run web
pnpm run web
yarn web
bun run web

Visit your new custom pages locally at localhost:8081/sign-in.

Next steps

Learn more about Clerk components, how to build custom flows, and how to use Clerk's client-side helpers using the following guides.

Create a custom sign-up page

Learn how to add a custom sign-up page to your app with Clerk's components.

Prebuilt components

Learn how to quickly add authentication to your app using Clerk's suite of components.

Customization & localization

Learn how to customize and localize Clerk components.

Build custom flows

Learn how to build custom user interfaces entirely from scratch using the Clerk API.

Client-side helpers

Learn more about Clerk's client-side helpers and how to use them.

Feedback

What did you think of this content?

Last updated on