How do I switch organizations when using @auth0/auth0-vue

I am using the Vue PKCE library to handle auth. A user can be in 1 to many orgs but I have to declare the org when I setup the Vue App…

const app = createApp(App);
// TODO: Get Vite to inject the domain and client values
app.use(
    createAuth0({
      domain: ...,
      client_id: ...,
      redirect_uri: window.location.origin,
      prompt: "consent",
      useRefreshTokens: true,
      organization: ...,
    }),
);

This works but I can’t figure a way to change the org or use multiple orgs. Is this possible given the construct?

Hi @jgleason!

While you won’t be able to use multiple orgs at once, you could look into “switching” orgs by doing silent auth and including the organization param. You need to make another /authorize request with the new org_id in order to specify the “new” org. While I haven’t attempted this using the vue SDK myself, the following topic may be useful:

Let us know if you’re able to make any progress!

RT but this doesn’t seem to be easily done with auth0-spa-js and Vue, since it is attached to the Vue instance I think I would have to setup a whole new Vue instance.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.