SohoHouse / nuxt-oauth

Simple OAuth2 integration for your Nuxt app
MIT License
122 stars 27 forks source link

Redirect loop on invalid code in onLogout() or fetchUser() #17

Closed marianhlavac closed 6 years ago

marianhlavac commented 6 years ago

I had error in my fetchUser() function, so it started to redirect back and forth infinitely.

Redirecting back to OAuth doesn't solve the problem, if the error isn't on the OAuth authenticator side.

https://github.com/samtgarson/nuxt-oauth/blob/bf4265eadf7aee1385608e0ddf820193edc39a6a/lib/handler.js#L73

This isn't such a big problem, but was confusing for me at first.

samtgarson commented 6 years ago

Thanks for the issue report, I didn't catch that. I'll put in a fix when I have some time

col-panic commented 6 years ago

I'm just trying the example and do get the same result of infinite redirections. How can I patch the code s.t. it works properly?

samtgarson commented 6 years ago

This is fixed in #20. For future reference, you could also put a try...catch around your fetch user function to avoid the error bubbling up.

col-panic commented 6 years ago

Thanks a lot - could you please provide v1.1.0 via npm?

samtgarson commented 6 years ago

✅ Done