Platform-specific redirect_url

Do I have to use app.use in main.js in a Vue 3 app? My issue is that I need to dynamically set the redirect_url to a different one for iOS or web platform. I use Ionic’s getPlatforms to detect the platform, but that happens AFTER app.use already setup Auth0 in main.js. Therefore I cannot change the redirect. Is there a way to load the auth0 from outside of main.js AFTER I get the platform?

const app = createApp(App)
  .use(router)
  .use(pinia)
  .use(IonicVue)
  .use(
    createAuth0({
      domain: "XXX.us.auth0.com",
      client_id: "XXX",
      redirect_uri: "XXX"
    })
  )

I solved it using Ionic Vue’s getPlatforms to automatically switch the redirect url between native ios and web
redirect_uri: platform == ‘ios’? “XXX.XXX.app://XXX.us.auth0.com/capacitor/XXX.XXX.app/callback”: window.location.origin

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