race-stack icon indicating copy to clipboard operation
race-stack copied to clipboard

How to dynamically set the cookie secrets value

Open magbicaleman opened this issue 10 months ago • 3 comments

In the https://github.com/jose-donato/race-stack/blob/main/app/lib/cookie.server.ts the secret value has the following comment

secrets: ["replace_me"], // replace this with an actual secret

Given that this is meant for cloudflare stack how do you get the environment variable secret into this cookie? I might be missing something. Since the environment variables come from action context.

Thanks for putting this together.

magbicaleman avatar Feb 18 '25 21:02 magbicaleman

In the https://github.com/jose-donato/race-stack/blob/main/app/lib/cookie.server.ts the secret value has the following comment

secrets: ["replace_me"], // replace this with an actual secret

Given that this is meant for cloudflare stack how do you get the environment variable secret into this cookie? I might be missing something. Since the environment variables come from action context.

Thanks for putting this together.

hey sorry for the delay.

that's a good question. when I first did this I didn't find a good solution either.

https://developers.cloudflare.com/workers/configuration/secrets/

I would search something in this documentation page. let me know if you find any good solution! 😄

jose-donato avatar Feb 22 '25 15:02 jose-donato

I'm trying to use an approach similar to remix-auth-totp

which can be found here:

  • https://github.com/mw10013/remix-auth-totp-cloudflare-example/blob/main/app/lib/services.server.ts

and here is how they use it:

  • https://github.com/mw10013/remix-auth-totp-cloudflare-example/blob/main/app/routes/account.tsx

magbicaleman avatar Feb 24 '25 18:02 magbicaleman

I'm trying to use an approach similar to remix-auth-totp

which can be found here:

* [mw10013/remix-auth-totp-cloudflare-example@`main`/app/lib/services.server.ts](https://github.com/mw10013/remix-auth-totp-cloudflare-example/blob/main/app/lib/services.server.ts)

and here is how they use it:

* [mw10013/remix-auth-totp-cloudflare-example@`main`/app/routes/account.tsx](https://github.com/mw10013/remix-auth-totp-cloudflare-example/blob/main/app/routes/account.tsx)

thanks for sharing!

jose-donato avatar Feb 24 '25 20:02 jose-donato