Content
@
0 reply
0 recast
2 reactions
Matthew
@matthew
is anyone aware of a way to sign in a user via an api route in nextjs + nextauth? specifically trying to auth users when coming through warpcast—the post api route that warpcast sends has the user's fid, and I want to sign them via on the post route handler
1 reply
0 recast
5 reactions
dylan
@dylsteck.eth
i have a SIWF x NextAuth example here, I think you'd essentially turn the auth.ts into a POST request or use the default POST handler as long as you have the right body https://github.com/farhackxyz/farhack/blob/main/auth.ts
1 reply
0 recast
0 reaction
Matthew
@matthew
hmmm I think there might be something else going on then. this is what my route looks like—the sign in provider I have is similar to yours and doesn't throw an error in my code. I think the question here is if you sign someone in using a server route like so, can you access after on the client? Haven't been able to find any docs on it which is weird
1 reply
0 recast
1 reaction
Zinger ↑ is job hunting
@zinger
Best way to do this is sign them in in the API request and then send back cookies with the response to keep them signed in on the client
1 reply
0 recast
2 reactions
Matthew
@matthew
yeah was trying to do that but the session cookies weren't passing down, and if I tried the reverse (sign in from the client) it wouldn't pass the CSRF up, so my guess is that something about the iframe in WC is blocking cookies. maybe @horsefacts.eth knows if this would be the case?
1 reply
0 recast
1 reaction
Zinger ↑ is job hunting
@zinger
Ah yeah I wouldn’t be surprised if there’s some weird sandboxing behavior around iframes and cookies
1 reply
0 recast
1 reaction