sidebase / nuxt-auth

Authentication built for Nuxt 3! Easily add authentication via OAuth providers, credentials or Email Magic URLs!
https://auth.sidebase.io
MIT License
1.25k stars 162 forks source link

enh(#861): Redirect back to requested page after authentication #870

Closed andychukse closed 1 week ago

andychukse commented 1 month ago

๐Ÿ”— Linked issue

861

โ“ Type of change

๐Ÿ“š Description

Add functionality redirect user back to requested page after authentication Added a redirect query parameter to auth middleware navigateTo when a guest visits authenicated page. This will help users redirect back to previous page after sign in. Currently when guest tries to access a protected page they are redirected to /login page and after login they are redirect to default callbackUrlunless they specify callbackUrl in the signIn function.

This feature will help automatically redirect a user back to the page they requested after login. For example, if they requested to access '/profile' and they are redirected to login page, after successful login, they will be redirected back to '/profile'. They can also override this by providing a callbackUrlin the signIn function as it is currently

๐Ÿ“ Checklist

YarikSWT commented 3 weeks ago

Really looking forward to this feature

pkg-pr-new[bot] commented 2 weeks ago

Open in Stackblitz

pnpm add https://pkg.pr.new/@sidebase/nuxt-auth@870

commit: 2372149

zoey-kaiser commented 1 week ago

PR Released in https://github.com/sidebase/nuxt-auth/releases/tag/0.9.3 ๐Ÿฅณ