xamarot
Explore posts from serversBABetter Auth
•Created by Acro on 2/9/2025 in #help
SvelteKit Exsmple
The main branch is simply "hiding" the entire app behind github or MS SSO, but there is a branch which has sign up enabled instead.
9 replies
BABetter Auth
•Created by Acro on 2/9/2025 in #help
SvelteKit Exsmple
Hello, I have an example doing something like this here https://github.com/zicho/betterauth-sso
Feel free to fork it or ask questions or whatever
9 replies
BABetter Auth
•Created by xamarot on 1/20/2025 in #help
Setting session/cookie after OAuth redirect
Sorry for spam but I think it's working now
I would like to submit this example to the docs if possible? Might be good for future users of sveltekit and betterauth
37 replies
BABetter Auth
•Created by xamarot on 1/20/2025 in #help
Setting session/cookie after OAuth redirect
Is it possible i need a special case for when the server request is aimed at the auth callback?
37 replies
BABetter Auth
•Created by xamarot on 1/20/2025 in #help
Setting session/cookie after OAuth redirect
Shouldnt the [...all] callback handle setting the session before the app is again redirected back from the OAuth sign in?
37 replies
BABetter Auth
•Created by xamarot on 1/20/2025 in #help
Setting session/cookie after OAuth redirect
Seems to me like something like this should work?
But session is always null. However, if I disable the redirect, I can see that I get the session and all that. I just need to check it before checking if i should be redirecting? But I do not understand how
37 replies
BABetter Auth
•Created by xamarot on 1/20/2025 in #help
Setting session/cookie after OAuth redirect
Ok, now it works:
However, I am still confused. How do I handle redirecting users to login if not in hooks?
37 replies
BABetter Auth
•Created by xamarot on 1/20/2025 in #help
Setting session/cookie after OAuth redirect
It throws an error, saying "TypeError: Cannot read properties of undefined (reading 'get')". Server endpoint looks like
37 replies
BABetter Auth
•Created by xamarot on 1/20/2025 in #help
Setting session/cookie after OAuth redirect
And if I want to redirect all users to sign up (don't want any unauthorized users reach any page of my app) how should I do it if not redirecting to the sign in?
37 replies
BABetter Auth
•Created by xamarot on 1/20/2025 in #help
Setting session/cookie after OAuth redirect
What do you mean? Are login and signin different pages? And I can't see any 200 coming from my localhost, only 302s are being returned
37 replies
BABetter Auth
•Created by xamarot on 1/20/2025 in #help
Setting session/cookie after OAuth redirect
it still just keeps redirecting
37 replies
BABetter Auth
•Created by xamarot on 1/20/2025 in #help
Setting session/cookie after OAuth redirect
it seems like session should at least be present in hooks after the first callback to the +server endpoint?
37 replies
BABetter Auth
•Created by xamarot on 1/20/2025 in #help
Setting session/cookie after OAuth redirect
So now my hooks is this:
and /api/auth/callback/github/+server.ts
session and headers are still null and I keep just getting redirected to my login
37 replies
BABetter Auth
•Created by xamarot on 1/20/2025 in #help
Setting session/cookie after OAuth redirect
in the next docs it tells you to do
export const { GET, POST } = toNextJsHandler(auth.handler);
but SvelteKit has no examples and this const { GET, POST } = toSvelteKitHandler(auth.handler);
does not seem to work37 replies
BABetter Auth
•Created by xamarot on 1/20/2025 in #help
Setting session/cookie after OAuth redirect
how do I do that in a server endpoint? AFAIK "resolve" does not exist there
37 replies
BABetter Auth
•Created by xamarot on 1/20/2025 in #help
Setting session/cookie after OAuth redirect
so, returning ´return svelteKitHandler({ event, resolve, auth });' in hooks and auth endpoint?
37 replies
BABetter Auth
•Created by xamarot on 1/20/2025 in #help
Setting session/cookie after OAuth redirect
Or something else?
37 replies
BABetter Auth
•Created by xamarot on 1/20/2025 in #help
Setting session/cookie after OAuth redirect
like an /api/auth/callback/github?
37 replies
BABetter Auth
•Created by xamarot on 1/20/2025 in #help
Setting session/cookie after OAuth redirect
am I using the svelteKitHandler correctly? because I feel like i should use it if I have the session, otherwise redirect
37 replies