-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0eb97f0
commit 985dc73
Showing
1 changed file
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |