OAuth Hopper
Hop over OAuth2 services
OAuth Hopper exposes OAuth2 services behind normal Basic Access Authentication so that you can access them through clients that don't support OAuth2. It is meant to run as a Cloudflare Worker.
Requirements
- An OAuth2 token
Setup
- Create a new Cloudflare Worker
- Under "Settings", "Variables", Create the following Environment Variables:
CLIENT_ID
- Your OAuth2 Client IDCLIENT_SECRET
Your OAuth2 Client SecretHOSTNAME
- The hostname of the resource you're trying to hop over. For example, Google's one isapidata.googleusercontent.com
REFRESH_ENDPOINT
- The refresh endpoint of your OAuth2 provider. For example, Google's one ishttps://www.googleapis.com/oauth2/v4/token
REFRESH_TOKEN
- Your latest refresh tokenUSERNAME
- The username you want to connect withPASSWORD
- The password you want to use when connecting
- Create a new Workers KV namespace, and under "KV Namespace Bindings" map it to a variable called
KEYS
- In the the KV namespace, create a key called
access_token
with the following JSON value:{"token":"XYZ","expiry":0}
(replaceXYZ
with your latest access token) - Copy the content of index.js to your worker
- Connect to the resource using the URL of your Worker - OAuth Hopper will proxy the resource for you while hopping over OAuth!