-
-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
signIn with callbackUrl: undefined returns an error instead of navigating to the previous page #656
Comments
I ran into this problem also. First, I have a simple workaround implemented for now:
Second, I tried to debug this error, but I could not get to the bottom of the problem in this package.
|
It works only for internal navigation though, doesn't it? If I arrive from an external route (ie: a page refresh) it doesn't work. The redirect to the login page from the protected routes, if i'm not mistaken, is handled as external so it won't work.
Second this, the |
I also confronted this problem but for some reason only after uaing it with signUp, like this:
this will throw an error (text bellow) even though registration and signing will be complete. But I cannot use redirect nor via callbackUrl nor via NavigateTo because code go to catch block error message:
|
I am not sure I fully understand. The auth middleware (logged in guard) is working as intended for me. When you set this:
So if you come from an external route and you are not logged in you will be redirected to the login page. If you are already logged in (session in local storage / cookie / etc.) then there is no need to use If you come from an external page directly to (or refresh on) the login page then the |
@Vitalii-Kh95 Why can't you adjust your code to this?
So you add the second options parameter to the signIn call with the callbackUrl? |
@bitfactory-frank-spee That is the problem: I did add callbackUrl and function threw an error. I simply deleted redirection and it threw the error anyway. |
@Vitalii-Kh95 Hmm, if it works it works 🙂. Make sure to check the documentation on local provider here: https://sidebase.io/nuxt-auth/configuration/nuxt-config and here: https://sidebase.io/nuxt-auth/application-side/session-access-and-management |
Environment
Reproduction
No response
Describe the bug
I'm using the local provider.
I expect the signIn function to take the user back to the pages they were trying to access while not being logged (or the index page if none was provided) but instead it returns the following error:
Navigating to an external URL is not allowed by default. Use navigateTo(url, { external: true })
The code I'm using:
More so, even if I pass
external: true
it returns the same error anywayAdditional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: