Trouble creating an Ory based login

Hey there, I'm triing to build a Login with ory and solid start but I'm really getting trouble doing all those cookie things. The Steps: Hitting the registration page Getting a so called "Flow" from Ory (by using the cookies to ensure there is no active session) Retreiving the flow and displaying the form also pipe the headers to set the csrf that we got send by ory Submitting the form directly to the Ory instance itself Ory will then redirect to the verify route and set a few cookies by header For the verify route i again have to fetch a flow but this time i need to include the cookies into the request After that i need to set new cookies by the returned headers from ory and display the flow In particular I need something that can retreive all the headers on server side and the client side and that can pipe this information into an whatever function on the backend (currently a (t)rpc) that I could use in order to get stuff from ory. In Remix i had things like a loader that i could use for that. But in Solid Start such a thing does not exists. Using an action that only runs on the server ends in a super slow user interface. The moment i try to use the function on the client too i get an render issue becuase the functions i use are meant to run on the server. Using the HttpHeader Components isn't working because it, for some reason, throws errors while rendering. (i can use hardcoded values but nothing dynamic) I Also tried to use Trpc for doing that but inside of the trpc query for some reason the cookie header is gone. I didn't try API routes until yet because i thought maybe I'm able to do it directly inside of a component like e.g. the LoginForm itself.
1 Reply
Brendonovich
Brendonovich3mo ago
can't you just read the auth cookie in your trpc middleware and go from there? we do that but use lucia instead of ory https://github.com/mattrax/Mattrax/blob/373223c047df0fbffe4ea5fe4dc76bcbf9a891bc/apps/web/src/api/trpc/helpers.ts#L44
GitHub
Mattrax/apps/web/src/api/trpc/helpers.ts at 373223c047df0fbffe4ea5f...
Open source MDM for all your devices. Contribute to mattrax/Mattrax development by creating an account on GitHub.