bjerkio/oidc-react

Simple way to disable AuthProvider in development environment?

denniskrq opened this issue · 2 comments

Is there a simple way to render the AuthProvider non-functional (but present) if process.env.NODE_ENV === "development"? Additionally, since useAuth() is a hook, it can't be conditionally called based on whether the environment is development, so I can't just omit AuthProvider in dev and not call useAuth()

Hm, what's the use-case for this? Simplify frontend development?

Yeah, to skip the login requirement during development. I've achieved this now with a combination of:

  • If environment is dev, set autoSignIn to false
  • If environment is dev, return app directly instead of a login prompt in App.tsx