Installation

First, you need to set up a Corbado project.

To get started with the integration, install the Corbado web-js package:

npm install @corbado/web-js

If your project uses TypeScript, you should also install the types for the package:

npm install -D @corbado/types

Set up Corbado

As a prerequisite to all future actions, Corbado has to be loaded. We do this by using the Corbado.load() function. We also maintain a global state, indicating whether Corbado is successfully loaded.

layouts/default.vue
<script setup lang="ts">
import Corbado from "@corbado/web-js"
import {onMounted} from "vue";

const isCorbadoLoaded = useState('isCorbadoLoaded', () => false)

onMounted(async () => {
    await Corbado.load({
        projectId: "pro-XXX",
        darkMode: "off"
    })
    isCorbadoLoaded.value = true
})

provide('isCorbadoLoaded', isCorbadoLoaded)
</script>

<template>
    <slot/>
</template>

Configuration

Most configuration is done in the . The following options are available:

NameTypeDefaultDescription
projectIdstring (e.g. pro-1234567890)requiredThe ID of your Corbado project. This setting is mandatory and can be found in the Developer Panel.
autoDetectLanguagebooleantrueIf set to true the language used in UI components will be derived from the browser.
defaultLanguagestringenThe default language to be used if auto-detection is disabled or fails. Corbado supports “en”, “de” and “fr”. You can define custom translations though.
customTranslationsobjectnullA map from language (e.g. “en”) to an object containing your custom translation overrides. Find more details here
darkModeon | off | autoautoControls if your components are rendered in dark mode. If set to auto the darkMode setting will be derived from the browser.
themestringundefinedControls the style of your components. Currently, the only alternative theme that can be set here is emerald-funk. To create your own custom theme find all information here.
customerSupportEmailstringundefinedEmail address for customer support in case of critical errors.
isDevModebooleanfalseIf set to true, the UI components will log debug messages to console.
frontendApiUrlstringSet to your Frontend API URLPlease set this value when you go live to your defined CNAME.
setShortSessionCookiebooleanfalseIf set to true, a cbo_short_session cookie will be set automatically by the Corbado component for the current domain. This setting makes sense if you are running a full stack application (e.g. Next.js) or a multi page application (e.g. PHP).
apiTimeoutnumber30000Front-end api timeout time in miliseconds

Next

  1. Add authentication UI components to your application.
  2. Let your users manage their passkeys with the PasskeyList.
  3. Learn how you can access the users authentication state on the client-side.
  4. Easily access user information on the server-side with the Node.js SDK.