Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a server side version of SvelteKit signIn() / signOut()? #7098

Closed
half2me opened this issue Mar 28, 2023 · 2 comments 路 Fixed by #9714
Closed

Is there a server side version of SvelteKit signIn() / signOut()? #7098

half2me opened this issue Mar 28, 2023 · 2 comments 路 Fixed by #9714
Labels
question Ask how to do something or how something works

Comments

@half2me
Copy link
Contributor

half2me commented Mar 28, 2023

Question 馃挰

There are examples of calling signIn() or signOut() from the browser, but I need to call this from the server in SSR context. Is this possible somehow?

How to reproduce 鈽曪笍

n/a

Contributing 馃檶馃徑

Yes, I am willing to help answer this question in a PR

@half2me half2me added the question Ask how to do something or how something works label Mar 28, 2023
@balazsorban44
Copy link
Member

Not officially, currently. @auth/core could potentially get support for this, together with the skipCSRFCheck option we introduced for framework authors, as many frameworks support sign-in functionality via SSR'd forms.

Docs: https://authjs.dev/reference/core#skipcsrfcheck

Would be interesting to know your use case, unfortunately, n/a is insufficient to give you more advice.

@half2me
Copy link
Contributor Author

half2me commented Mar 28, 2023

@balazsorban44 my use case would be to automatically forward users to the oauth login page when they attempt to access a page that is restricted for logged in users only. In SvelteKit this can be done by returning a 302 from the load function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Ask how to do something or how something works
Projects
None yet
2 participants