Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ottmartens committed Nov 12, 2023
1 parent 0eb97f0 commit 985dc73
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
# decap-cms-github-oauth-api-cloudflare-worker

A github oauth authentication gateway for Decap CMS login, runnable as a cloudflare worker
A github oauth authentication gateway for [Decap CMS](https://github.com/decaporg/decap-cms) login, runnable as a cloudflare worker

Use case - you want to use your Github repo as a CMS with Decap CMS, but don't want to rely on Netlify authentication backend. You can host this service on a cloudflare worker to authenticate with Github without a 3rd party.

## Setup

1. [Create a github app](https://docs.github.com/en/apps/creating-github-apps/registering-a-github-app/registering-a-github-app)
2. Fork this repository
3. [Create a cloudflare account](https://dash.cloudflare.com/) if you don't have one

4. Install the (Cloudflare) `wrangler` CLI and login with your account

```
npm install --global wrangler
wrangler login
```

5. Edit the `wrangler.toml` file, change the value for account_id to your own (`wrangler whoami` shows account ID)

6. Add the following secrets to your Cloudflare worker:

`CLIENT_ID`, `CLIENT_SECRET`: In your GitHub App's settings page, find the Client ID and generate a Client Secret

```
wrangler secret put CLIENT_ID
wrangler secret put CLIENT_SECRET
```

7. Configure Github action for deploying the worker – create a new [Cloudflare API token](https://dash.cloudflare.com/profile/api-tokens)(Use "Edit Cloudflare Workers" template) and add it as a secret in your fork's repository settings->secrets->actions.

## Credits

Inspiration from:

- https://github.com/gr2m/cloudflare-worker-github-oauth-login
- https://github.com/vencax/netlify-cms-github-oauth-provider

0 comments on commit 985dc73

Please sign in to comment.