Skip to content

Commit 7c59012

Browse files
committed
Add initial files
0 parents  commit 7c59012

File tree

11 files changed

+3551
-0
lines changed

11 files changed

+3551
-0
lines changed

.devs.vars.example

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CLIENT_ID=XXXXX
2+
CLIENT_SECRET=XXXX
3+
4+
PLUGIN_URI=https://localhost:5174
5+
REDIRECT_URI=http://localhost:8787/redirect
6+
7+
AUTHORIZE_ENDPOINT=https://accounts.google.com/o/oauth2/v2/auth
8+
TOKEN_ENDPOINT=https://oauth2.googleapis.com/token
9+
10+
SCOPE=https://www.googleapis.com/auth/userinfo.profile

.github/workflows/deploy.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Deploy Worker
2+
on:
3+
push:
4+
pull_request:
5+
repository_dispatch:
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
timeout-minutes: 60
10+
needs: test
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Build & Deploy Worker
14+
uses: cloudflare/wrangler-action@v3
15+
with:
16+
apiToken: ${{ secrets.CF_API_TOKEN }}
17+
accountId: ${{ secrets.CF_ACCOUNT_ID }}

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# dependencies
2+
node_modules/
3+
.pnp
4+
.pnp.js
5+
.yarn
6+
7+
# misc
8+
.DS_Store
9+
*.pem
10+
.wrangler/
11+
12+
# files
13+
my-plugin
14+
dev-plugin
15+
dist
16+
17+
# debug
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*
21+
22+
# local env files
23+
.env*.local
24+
.dev.vars

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# OAuth Backend for Framer Plugins
2+
3+
This is an example CloudFlare Worker that proxies OAuth 2.0 login requests and handles token communication with a Framer plugin.
4+
5+
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/framer/plugin-oauth)
6+
7+
## Setup
8+
9+
### Environment variables
10+
11+
The following environment variables need to be added via the CloudFlare console or CLI.
12+
13+
| Name | Details |
14+
| ------------------ | ----------------------------------------------------------------------------------------------------------------------- |
15+
| CLIENT_ID | App ID created in the providers developer console |
16+
| CLIENT_SECRET | App secret key created in the providers developer console. **Do not expose** in source code or send back to the client! |
17+
| PLUGIN_URI | Root path of where your plugin is hosted |
18+
| REDIRECT_URI | Callback path that provider will redirect to after logging in |
19+
| AUTHORIZE_ENDPOINT | Provider endpoint path for showing the log in screen |
20+
| TOKEN_ENDPOINT | Provider endpoint path for fetching and refreshing access tokens |
21+
| SCOPE | Provider permissions separated by a space |
22+
23+
To test locally, create a `.dev.vars` file with your own `CLIENT_ID` and `CLIENT_SECRET`.
24+
25+
### Run locally
26+
27+
```sh
28+
# Install the dependencies.
29+
npm i
30+
31+
# Start the worker locally
32+
npm run dev
33+
```

0 commit comments

Comments
 (0)