1. Prerequisites

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

Further information on web-js can be found here

2. Add web-js to Nuxt.js code

App.vue
<template>
    <div id="corbado-auth"></div>
</template>

<script setup>
    import Corbado from "@corbado/web-js";
    import { onMounted } from "vue";

    onMounted(() => {
        //if user is authenticated you can navigate to a protected route
        if (Corbado.isAuthenticated) {
            return;
        }

        const authElement = document.getElementById("corbado-auth"); //Element where you want to render CorbadoAuth UI

        Corbado.mountAuthUI(authElement, {
            onLoggedIn: () => {
                //post login actions can be performed here.
            }
        });
    });
</script>

If you need access to user data on the server, also take a look at our Corbado Node.js SDK.

3. Read the blog post

To find a step-by-step tutorial on how to integrate passkeys into Nuxt.js, please check out our blog post:

Corbado Logo