Cannot use passwordless redirect with auth0-vue 2.x

Hi, with the previous 1.x version I could trigger the passwordless login prompt with this code:

loginWithRedirect({
  passwordless: "true",
});

However in 2.x that option is no longer there. I am sure there is still a way to do this but I couldn’t figure it out. Can anyone assist?

My current code:

// main.ts
import App from "@/App.vue";
import "@/assets/styles/main.scss";
import { createRouter } from "@/router";
import { createPinia } from "pinia";
import { createApp } from "vue";
import { createMetaManager, plugin as metaPlugin } from "vue-meta";
import { createAuth0 } from "@auth0/auth0-vue";

const app = createApp(App);

app.use(
  createAuth0({
    domain: import.meta.env.VITE_AUTH0_DOMAIN,
    clientId: import.meta.env.VITE_AUTH0_CLIENT_ID,
    cacheLocation: "localstorage",
    useRefreshTokens: true,
    authorizationParams: {
      audience: import.meta.env.VITE_AUTH0_AUDIENCE,
      redirect_uri: location.origin,
      scope: "token id_token",
    },
  })
);
app.use(createMetaManager());
app.use(metaPlugin);
app.use(createRouter(app));
app.use(createPinia());

app.mount("#app");
// router.ts
import { createAuthGuard } from "@auth0/auth0-vue";
import { createRouter as createVueRouter, createWebHistory } from "vue-router";
import type { App } from "vue";

export function createRouter(app: App) {
  const router = createVueRouter(...);
  const guard = createAuthGuard(app);
  router.beforeEach(guard);
  return router;
}

Also there is no “auth0-vue” tag and the forum enforces a minimum of 2 tags so I tagged it under “auth0-react”.

1 Like

I think there is a way to do this with

auth0.WebAuth

Here is the documentation https://auth0.com/docs/libraries/auth0js

I haven’t tried it yet however. Will attempt in a few. If you are able to do this faster please report back.

1 Like

That would mean discarding auth0-vue though?

I am going to wait until they add support for it in Auth0-vue… But yeah I would think if you want to use auth0js you might have to pivot.

1 Like