Skip to content

Commit

Permalink
Add initial files
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyec committed May 28, 2024
0 parents commit 02de379
Show file tree
Hide file tree
Showing 11 changed files with 3,541 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .devs.vars.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CLIENT_ID=XXXXX
CLIENT_SECRET=XXXX

PLUGIN_URI=https://localhost:5174
REDIRECT_URI=http://localhost:8787/redirect

AUTHORIZE_ENDPOINT=https://accounts.google.com/o/oauth2/v2/auth
TOKEN_ENDPOINT=https://oauth2.googleapis.com/token

SCOPE=https://www.googleapis.com/auth/userinfo.profile
17 changes: 17 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Deploy Worker
on:
push:
pull_request:
repository_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 60
needs: test
steps:
- uses: actions/checkout@v2
- name: Build & Deploy Worker
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# dependencies
node_modules/
.pnp
.pnp.js
.yarn

# misc
.DS_Store
*.pem
.wrangler/

# files
my-plugin
dev-plugin
dist

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local
.dev.vars
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OAuth Backend for Framer Plugins

This is an example CloudFlare Worker that proxies OAuth 2.0 login requests and handles token communication with a Framer plugin.

[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/framer/plugin-oauth)

## Setup

### Environment variables

The following environment variables need to be added via the CloudFlare console or CLI.

| Name | Details |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------- |
| CLIENT_ID | App ID created in the providers developer console |
| CLIENT_SECRET | App secret key created in the providers developer console. **Do not expose** in source code or send back to the client! |
| PLUGIN_URI | Root path of where your plugin is hosted |
| REDIRECT_URI | Callback path that provider will redirect to after logging in |
| AUTHORIZE_ENDPOINT | Provider endpoint path for showing the log in screen |
| TOKEN_ENDPOINT | Provider endpoint path for fetching and refreshing access tokens |
| SCOPE | Provider permissions separated by a space |

To test locally, create a `.dev.vars` file with your own `CLIENT_ID` and `CLIENT_SECRET`.
Loading

0 comments on commit 02de379

Please sign in to comment.