N
Nuxt6mo ago
sh

Using Nuxt's Router with @zitadel/vue

Hello, I need help on getting zitadel's vue api's routes registered on the router. I have tried putting it in a plugin to no avail.
1 Reply
sh
shOP6mo ago
Here is the code
import { createZITADELAuth } from "@zitadel/vue";
import { User } from 'oidc-client';

export default defineNuxtPlugin(async () => {
const zitadelAuth = createZITADELAuth({
project_resource_id: "resource_id",
client_id: "clientid@project",
issuer: "https://provider.zitadel.cloud/",
});

const ok = await zitadelAuth.oidcAuth.startup();

if (!ok) {
throw new Error("oidc startup failed");
} else {
console.info("Zitadel Auth initialized");

const router = useRouter();

zitadelAuth.oidcAuth.useRouter(router);

console.log(router)

return {
provide: {
zitadel: zitadelAuth
}
}
}
});
import { createZITADELAuth } from "@zitadel/vue";
import { User } from 'oidc-client';

export default defineNuxtPlugin(async () => {
const zitadelAuth = createZITADELAuth({
project_resource_id: "resource_id",
client_id: "clientid@project",
issuer: "https://provider.zitadel.cloud/",
});

const ok = await zitadelAuth.oidcAuth.startup();

if (!ok) {
throw new Error("oidc startup failed");
} else {
console.info("Zitadel Auth initialized");

const router = useRouter();

zitadelAuth.oidcAuth.useRouter(router);

console.log(router)

return {
provide: {
zitadel: zitadelAuth
}
}
}
});
Want results from more Discord servers?
Add your server