{"_id":"@autotelic/oauth-gateway-worker","_rev":"2-fa807d649a25ac814ae724892fdd2627","name":"@autotelic/oauth-gateway-worker","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@autotelic/oauth-gateway-worker","version":"0.1.0","description":"A template for kick starting a Cloudflare Workers project","main":"index.js","author":{"name":"Edward Stone","email":"ed@autotelic.com"},"license":"MIT","scripts":{"test":"tap","lint":"standard","lint:fix":"npm run lint --fix","validate":"npm run lint && npm run test"},"dependencies":{"base64url":"^3.0.1","standard":"^16.0.3"},"devDependencies":{"tap":"^14.11.0"},"gitHead":"1b6de8a8be40f3161909fd5b2c01cc5a6708165a","_id":"@autotelic/oauth-gateway-worker@0.1.0","_nodeVersion":"14.13.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-qudzOvYqWeNfCZ18WPTwCuk6YGmHOlUA+bb9DgfVQat+GTjwJeQT28UQE282VPjo1VY1bLWhsncfNKtuzi6SxQ==","shasum":"2f59035764dde1ce772bc6f434f0faf8492ff5ad","tarball":"https://registry.npmjs.org/@autotelic/oauth-gateway-worker/-/oauth-gateway-worker-0.1.0.tgz","fileCount":6,"unpackedSize":9275,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf05ZFCRA9TVsSAnZWagAApfMP/jer+gb0fASSfH5kG5zI\ne05IpbXtaap1CbjG9AjPDUIS44Ah7c4ChSBI8Rz7Qqngw0ykt+OkCbBFcd+x\nNLgpLV0xzNXYRtAsh7hkwG4jQD/bC0SY0UuIhFdS5gNwuTbtIYW5vZfUrzbK\ny9u9W0DIsdje0aTAGvVyoD5Q2/U/gBw12mHeVhAqyZL/eKJx7YixO8KylFsW\nfNMzt0mtFjlbnLkaakqkU8vE0mu7IaZuFegSRzMNKUGZKan3Yy7d3A/XnNaT\nYVsJkb0/8YEmhrW6HxRoDqfHYs1pnptzJI8909TyZpXoOTj4czNU/rXxpF4v\nBCxsbKa5f6iqh7oDsskKVFR8ziVWjXtOKJ+NIP125wuTFOBY5RC85C+fpRzW\n4Uv8x6fMz1owPvaAdamaRDvrv0eeUmNMQVShVvm8AI5Ms8YexYJfntOIm0+Z\np8gXZMZalZOt96WZ2cjaF9W94akS8aaBc3EqbLmvOL7vgKbUqL2MnCnGPwe8\nWx/+GrtpEiwo7dwPoMX06y7CYsoukPR+Q2I/r82M/7qzmMXxtvLf3AeP4JL9\nl72gO7I0OqmCUzInqJSIGCWGviJ29KdZr1BI33wgOiYUfRfrDFfDzRIMtyHq\nvoJCYkGHXflQT0lg3hkaFsX+BlgiYcperjM4owF8sOqHJMqHz10rYbHTD41L\n+zT5\r\n=rNeV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAIVmZZH2971zB11Wjua78UAsyGB/kOqNzPf3MiHhryMAiEAz78TV4YnqjLp0jW7pnwJf7vGnTjQTrRxtSYOM6NTdfg="}]},"_npmUser":{"name":"autotelic","email":"info+npm@autotelic.com"},"directories":{},"maintainers":[{"name":"autotelic","email":"info+npm@autotelic.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/oauth-gateway-worker_0.1.0_1607702084567_0.6569057673053029"},"_hasShrinkwrap":false},"0.1.1":{"name":"@autotelic/oauth-gateway-worker","version":"0.1.1","description":"A template for kick starting a Cloudflare Workers project","main":"index.js","author":{"name":"Edward Stone","email":"ed@autotelic.com"},"license":"MIT","scripts":{"test":"tap","lint":"standard","lint:fix":"npm run lint --fix","validate":"npm run lint && npm run test"},"dependencies":{"base64url":"^3.0.1","standard":"^16.0.3"},"devDependencies":{"tap":"^14.11.0"},"gitHead":"a39d00f6cd5883d1449bd010797b47dd756a1170","_id":"@autotelic/oauth-gateway-worker@0.1.1","_nodeVersion":"14.13.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-cjLHZLbGTZK97Q4YnFd5CzvhH5wWkRud9OB2exWwOP93qLsXnCiYGtiwgDzJ0TFLPfYeR2wfyZdoLd6PZzyXrQ==","shasum":"b78ca5b9a23336dd3bf39bfc7ec9d9acb577ec36","tarball":"https://registry.npmjs.org/@autotelic/oauth-gateway-worker/-/oauth-gateway-worker-0.1.1.tgz","fileCount":6,"unpackedSize":9745,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf19PFCRA9TVsSAnZWagAAxxcP/1HnHAgyFwm8mDnB4Eml\nd2wP3Nxp+eBEUArM+6n5GbCmRpoCMeVRDCM7Od0nQTZUr4n33kOo5HBhvSqB\nHhg4/Ok/Vgwt6LBkipK13f2bn5DXaCibKrKHBtPS2ork3MMbz5SVOlP2VTXm\nTFbRyW1LHKlailUPMj6fSx9Bqb+XVUU9iWFLgNRJBAgOYSxurWMQqwXbWOXj\n6qwzEXrg0DcCkvm5KGNdtX2+/NeQZG5AVCauJIQs60/h78bbVXN0I8CrroKE\nB1//O0eidMOcQLQC/xvvRX15YjHDFwJ5kaH+iCjhU5PtviF5U7w5buQBZPNR\nlFqXPU0oztvDoz9ZKYhgZhcmkWjCUSAsZb8puDRqCZVZcVsH/3wwiE4eLSbA\nuIOVBGAhQ/mjGDYS88j+So+1ZztuECc/z9+aHT/zn0GQziD+5Dix1rRPFik6\nYEx0fYazNbfyqr+E2a2H1+NZiApC3TaAANcD6QEhtuPE31eys9ik90cowIbs\npYs23MpNDWZrNjLb4soyLQnMg0IgRMZgqrCsvIh7HNlOyqcCQwaavLzcdMK3\nHYW9FIp9SVrzlyXkBdh2I4rBdCGxoAvP8rBRS14nboVAJsSLS6BHQr4/6TDO\nmXY7RTHrvKzeeeoq5ud5WTUwmAWhXXeVapzfCusxS6MebyrxUVxcJ5YG9Hek\n3AZf\r\n=+ytT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB+E8dtGipmy1rvHSKrOkU1BUXdZ2pbJonbhCVaR4JsJAiAZcuUgWzvFv+HGru694sQRjx7kPGObmjCEEY1CtjDCYw=="}]},"_npmUser":{"name":"autotelic","email":"info+npm@autotelic.com"},"directories":{},"maintainers":[{"name":"autotelic","email":"info+npm@autotelic.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/oauth-gateway-worker_0.1.1_1607979972916_0.5629584241996248"},"_hasShrinkwrap":false}},"time":{"created":"2020-12-11T15:54:44.512Z","0.1.0":"2020-12-11T15:54:44.725Z","modified":"2022-04-04T16:40:50.880Z","0.1.1":"2020-12-14T21:06:13.113Z"},"maintainers":[{"name":"autotelic","email":"info+npm@autotelic.com"}],"description":"A template for kick starting a Cloudflare Workers project","author":{"name":"Edward Stone","email":"ed@autotelic.com"},"license":"MIT","readme":"# API Oauth\n\nA cloudflare worker to provide authentication for an API (currently setup for Github oauth).\n\nTODO: make oauth and route configurable so this is a generic worker template for the [generate command](https://developers.cloudflare.com/workers/cli-wrangler/commands#generate).\n\n## Setup\n\n```\nnpm i @autotelic/oauth-gateway-worker\n```\n\n### Cloudflare environments and deployment\n\n`wrangler.toml.example` is setup to show that there is a \"dev\" version of the worker deployed to the worker subdomain,\nand a \"production\" version.\n\nBoth environments require these secrets:\n\n- `GITHUB_APP_CLIENT_ID` - the client id of a github app\n- `GITHUB_APP_CLIENT_SECRET` - the client secret of the same github app\n- `B64URL_TOKEN_ENCRYPTION_KEY` - an AES-GCM-256 key [base64url encoded]() for symmetrically encrypting/decrypting the token we return\n- `kv-namespaces[].id` - ID of the production `AUTH_STORE` namespace \n- `kv-namespaces[].preview_id` - ID of the dev `AUTH_STORE` namespace\n\nIn addition `OAUTH_REDIRECT_URI` is defined in `wrangler.toml`\n\nUntil we have a GH action, deployment is using the wrangler cli:\n\n```\n$ wrangler publish\n```\nor\n```\n$ wrangler publish --env production\n```\nSee [the wrangler docs](https://developers.cloudflare.com/workers/cli-wrangler) for more.\n\n### Running locally in development\n\n```\n$ wrangler dev\n```\n\nwill setup a local server to run the worker from your codebase, by default on http://localhost:8787\n\nIf you would like to forward the requests to a locally running instance of the API, first run [an ngrok tunnel](https://ngrok.com/docs) pointing to your local instance of the API:\n\n```\n$ ngrok http 3000\n```\n\n(this assumes your API instance is running locally on port 3000)\n\nThen grab the https ngrok url you are given, and update the `UPSTREAM_HOST` in the `wrangler.toml` vars.\n\nRestart `wrangler dev` to pick up the change. Your local worker should now proxy via the ngrok tunnel to the local API.\n\n(It seems that cloudflare throws an error when you proxy to localhost, unfortunately)\n\n### On Heroku\n\nIf you are running the downstream API on Heroku, you will need to:\n\n- configure cloudflare and Heroku as documented here https://support.cloudflare.com/hc/en-us/articles/205893698-Configure-CloudFlare-and-Heroku-over-HTTPS\n- enable Dyno Metadata and ensure the API redirects to the cloudflare hosted domain\n\n### Usage\n\n- go to `/login` to be redirected to the authorization page\n- this will redirect to `/callback` and display a generated and encrypted token\n- use the token in an `Authorization: Bearer <token>` header for http requests to any other path of the API\n","readmeFilename":"README.md"}