<SignIn />

The component renders a UI for signing in users. The functionality of the component is controlled by the instance settings you specify in your OneAuxilia Dashboard, such as sign-in and sign-up options and social connections. You can further customize your component by passing additional properties at the time of rendering.

Note

The and components cannot render when a user is already signed in, unless the application allows multiple sessions. If a user is already signed in and the application only allows a single session, OneAuxilia will redirect the user to the Home URL instead.

Properties.

All props are optional.


appearance Appearance | undefined

Optional object to style your components. Will only affect OneAuxilia Components and not Account Portal pages.


routing 'hash' | 'path' | 'virtual'

The routing strategy for your pages. Defaults to 'path' in Next.js and Remix applications. Defaults to hash for all other SDK's.


path string

The path where the component is mounted on when routing is set to path. It is ignored in hash- and virtual-based routing. For example: /sign-in.


signUpUrl string

Full URL or path to the sign up page. Use this property to provide the target of the 'Sign Up' link that's rendered. It's recommended to use the environment variable instead.


forceRedirectUrl? string

If provided, this URL will always be redirected to after the user signs in. Takes priority over deprecated props such as afterSignInUrl and redirectUrl. It's recommended to use the environment variable instead.


fallbackRedirectUrl? string

The fallback URL to redirect to after the user signs in, if there's no redirect_url in the path already. Defaults to /. Takes priority over deprecated props such as afterSignInUrl and redirectUrl. It's recommended to use the environment variable instead.


signUpForceRedirectUrl? string

If provided, this URL will always be redirected to after the user signs up. Takes priority over deprecated props such as afterSignInUrl and redirectUrl. It's recommended to use the environment variable instead.


signUpFallbackRedirectUrl? string

The fallback URL to redirect to after the user signs up, if there's no redirect_url in the path already. Defaults to /. Takes priority over deprecated props such as afterSignInUrl and redirectUrl. It's recommended to use the environment variable instead.


initialValues SignInInitialValues

The values used to prefill the sign-in fields with.


transferable? boolean

Indicates whether or not sign in attempts are transferable to the sign up flow. Defaults to true. When set to false, prevents opaque sign ups when a user attempts to sign in via OAuth with an email that doesn't exist. See OAuth account transfer flows for more details.

Usage with frameworks

The following example includes basic implementation of the component. You can use this as a starting point for your own implementation.

The following example demonstrates how you can use the <SignIn /> component on a public page.

If you would like to create a dedicated /sign-in page in your Next.js application, check out the dedicated guide.

app/page.tsx
import { SignIn, useUser } from '@oneauxilia/nextjs'

export default function Home() {
  const { user } = useUser()

  if (!user) {
    return <SignIn />
  }

  return <div>Welcome!</div>
}

Usage with JavaScript

The following methods available on an instance of the OneAuxilia class are used to render and control the component:

  • mountSignIn()

  • unmountSignIn()

  • openSignIn()

  • closeSignIn()

The following examples assume that you have followed the quickstart in order to add OneAuxilia to your JavaScript application.

mountSignIn()

Render the <SignIn /> component to an HTML <div> element.

function mountSignIn(node: HTMLDivElement, props?: SignInProps): void

mountSignIn() params


node HTMLDivElement

The container <div> element used to render in the component


props? SignInProps

The properties to pass to the <SignIn /> component

mountSignIn() usage

index.js
import { OneAuxilia } from '@oneauxilia/oneauxilia-js'

// Initialize OneAuxilia with your OneAuxilia publishable key
const oneauxilia = new OneAuxilia('YOUR_PUBLISHABLE_KEY')
await oneauxilia.load()

document.getElementById('app').innerHTML = `
  <div id="sign-in"></div>
`

const signInDiv = document.getElementById('sign-in')

oneauxilia.mountSignIn(signInDiv)

unmountSignIn()

Unmount and run cleanup on an existing <SignIn /> component instance.

function unmountSignIn(node: HTMLDivElement): void

unmountSignIn() params


node HTMLDivElement

The container <div> element with a rendered <SignIn /> component instance

unmountSignIn() usage

index.js
import { OneAuxilia } from '@oneauxilia/oneauxilia-js'

// Initialize OneAuxilia with your OneAuxilia publishable key
const oneauxilia = new OneAuxilia('YOUR_PUBLISHABLE_KEY')
await oneauxilia.load()

document.getElementById('app').innerHTML = `
  <div id="sign-in"></div>
`

const signInDiv = document.getElementById('sign-in')

oneauxilia.mountSignIn(signInDiv)

// ...

oneauxilia.unmountSignIn(signInDiv)

openSignIn()

Opens the <SignIn /> component as an overlay at the root of your HTML body element.

function openSignIn(props?: SignInProps): void

openSignIn() params


props? SignInProps

The properties to pass to the <SignIn /> component.

openSignIn() usage

index.js
import { OneAuxilia } from '@oneauxilia/oneauxilia-js'

// Initialize OneAuxilia with your OneAuxilia publishable key
const oneauxilia = new OneAuxilia('YOUR_PUBLISHABLE_KEY')
await oneauxilia.load()

oneauxilia.openSignIn()

closeSignIn()

Closes the sign in overlay.

function closeSignIn(): void

closeSignIn() usage

index.js
import { OneAuxilia } from '@oneauxilia/oneauxilia-js'

// Initialize OneAuxilia with your OneAuxilia publishable key
const oneauxilia = new OneAuxilia('YOUR_PUBLISHABLE_KEY')
await oneauxilia.load()

oneauxilia.openSignIn()

// ...

oneauxilia.closeSignIn()

Last updated