Skip to content

Conversation

@helblinglilly
Copy link
Contributor

Summary

The code sample currently at https://developers.cloudflare.com/cloudflare-one/identity/authorization-cookie/cors/ would always result in an error at runtime as the environment variables are not consumed correctly.

Screenshots (optional)

https://developers.cloudflare.com/workers/configuration/environment-variables/#add-environment-variables-via-wrangler

Documentation checklist

The current worker example, as copy/pasted would never work at runtime as the environment variable values are not in scope and do not align with the current docs  https://developers.cloudflare.com/workers/configuration/environment-variables/#add-environment-variables-via-wrangler
@ranbel
Copy link
Contributor

ranbel commented Feb 18, 2025

Hi @helblinglilly, thanks for the PR! The current code example does not make any assumptions about where you're storing the Client ID and Client Secret. If we want to change the example to consume env variables, I recommend adding a step that explains how to store the Client ID and Client Secret as env variables (potentially after Step 1).

@helblinglilly
Copy link
Contributor Author

Hi @ranbel, thanks for taking a look!

Sorry if I'm misunderstanding something - the code might not make any assumptions yet but under this section: https://developers.cloudflare.com/cloudflare-one/identity/authorization-cookie/cors/#4-configure-the-worker sub-point 5 the docs go on to configure env variables.

I interpreted that as "let's write the worker and populate its values afterwards" - implying that the code snippet would not need modification between these steps.

Feel free to close this PR if you disagree or if I'm in the wrong part of the docs here 😅

@ranbel
Copy link
Contributor

ranbel commented Feb 18, 2025

Ah, you're right! I didn't see that we configure env variables in a later step. In that case this PR LGTM.

@ranbel ranbel enabled auto-merge (squash) February 18, 2025 21:00
@ranbel ranbel merged commit 63d7e4e into cloudflare:production Feb 18, 2025
7 checks passed
@workers-devprod workers-devprod added the contribution [Holopin] Recognizes a docs contribution, big or small label Feb 18, 2025
@holopin-bot
Copy link

holopin-bot bot commented Feb 18, 2025

Congratulations @helblinglilly, the maintainer of this repository has issued you a holobyte! Here it is: https://holopin.io/holobyte/cm7az79j828690cl439xtsgke

This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account.
Or if you're new to Holopin, you can simply sign up with GitHub, which will do the trick!

@helblinglilly helblinglilly deleted the patch-4 branch February 18, 2025 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution [Holopin] Recognizes a docs contribution, big or small product:cloudflare-one size/xs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants