Optimal way to handle OAuth2 callback without registering route
Hi π
I'm building an app where I'm handling OAuth2 callback in page
/auth/google/callback.vue
which only contains scripts block because I've to make API call to backend from query params I get. However, Because it's a page I've to write template block and also as this is page my nuxt app will get flash of the content due to quick redirection.
Hence, What will be the best way to register route handler that will hold up the navigation and don't render anything and just redirects to home page after call finishes without showing temp page in between.
I'm trying to use beforeEach guard but I think there can be better way. Also as this is making API call it should be async.
Thanks.4 Replies
I guess you could just await your API call in your script block so it suspends
Thanks for your prompt reply.
However, still it will be considered as a route/page
do you still get a flash of content with that?
I tried await and it looks like page is not visible in between. π₯
Thanks I'll let you know if something weird happens.