nuxt-community / auth-module

Zero-boilerplate authentication support for Nuxt 2
https://auth.nuxtjs.org
MIT License
1.93k stars 924 forks source link

1-step OAuth flow without `/login` redirects #1783

Open thisismydesign opened 2 years ago

thisismydesign commented 2 years ago

If I got it right the OAuth strategy flow works like this:

This seems super unnecessary. The OAuth flow I would like to have:

I tried to do this by calling $auth.login() when a protected page mounts. But I can't set redirect_uri dynamically to the current page, it will default to /login. This approach would still save the initial redirect to /login, and I could show a "Logged in successfully, you will be redirected" message when returning to /login which is not ideal but you can see it on some sites. But the automatic redirect back to where we came from doesn't work. I even tried setting it via e.g. $auth.$storage.setUniversal('redirect', route.fullPath) but no luck. I could implement this redirect myself but at this point, I feel like I'm fighting the framework.

How can I have this "simple" oauth flow?