Exchanges the code
from GitHub together with the client_secret
to obtain the oAuth access_token
, as outlined in step 2 of the oAuth web application flow.
This helper is necessary as the client_secret
cannot be exposed on any client-only application.
Deployed with Cloudflare Workers, eliminating the need for traditional server-based solutions like Gatekeeper.
Create a .dev.vars
file in the root directory and insert the client_secret
of the GitHub oAuth app like so:
CLIENT_SECRET=<YOUR_CLIENT_SECRET_HERE>
Refer to the Cloudflare guide to learn how to run the worker locally.
Before publishing the worker, we need to define the environment secret by running the following command:
wrangler secret put CLIENT_SECRET
See the Cloudflare docs for more information.