I am having trouble with cookies. Can't get the co...
# ory-network
b
I am having trouble with cookies. Can't get the cookies from my Ory cloud login to show up in 127.0.0.1 or localhost. I'm trying to build actix middleware and haven't found any good examples for integrating Kratos as middleware. (Also GitHub is down so oops haha)
h
Hey Adam 🙂 Are you using the Ory Proxy for local development?
b
Yes
I guess I could cname the cloud url to a subdomain and then map the primary domain in hosts to localhost. Is there a more friendly solution or is that the recommended pattern?
p
Heya @best-exabyte-6035 assuming you used the default port for the proxy, you should go to http://localhost:4000/.ory/ui/login to start the login flow (or .ory/ui/registration to create a new account). After you complete the flow, you'll have a valid session cookie for localhost that you can check against kratos. You can either rely on the proxy's JWT token injection, or call Kratos to verify the session. Here is the go middleware I wrote for my project to validate the session against Kratos. Don't hesitate to ask any question. In prod, I have an internet-facing nginx forwarding requests to
/.ory
to the proxy, and the rest to my app. I then use
<https://letsblock.it/.ory>
as kratos root url. Probably not completely cannon, but it translates gracefully to local dev. You could directly call the cloud domain to call
whoami
, but other endpoints currently need to go through the proxy.
b
I believe I completely missed the proxy somewhere along the line. Thanks for that, I found the command in your repo hopefully that works for me.
And thanks for the full middleware example for reference.
👍 1
h
Awesome, did you get it working now Adam? :)
b
Haven't had the opportunity yet, monday.
In the midst of building middleware for my app, hopefully after efforts today I will be able to report back.
h
Nice, let us know how it goes :)