Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joebobmiles/gcloud-githubproxy
A GCloud Function that serves as an API Proxy for GitHub.
https://github.com/joebobmiles/gcloud-githubproxy
api-proxy auth0-api github-api github-api-v4 google-cloud google-cloud-functions proxy
Last synced: 3 months ago
JSON representation
A GCloud Function that serves as an API Proxy for GitHub.
- Host: GitHub
- URL: https://github.com/joebobmiles/gcloud-githubproxy
- Owner: joebobmiles
- Archived: true
- Created: 2020-05-08T19:55:05.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-02-11T11:47:12.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T03:15:33.531Z (9 months ago)
- Topics: api-proxy, auth0-api, github-api, github-api-v4, google-cloud, google-cloud-functions, proxy
- Language: TypeScript
- Size: 446 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GCloud GitHub API Proxy
This is a GCloud Function for solving an embarrassingly simple problem: allowing
an app that has authenticated with GitHub via Auth0 to make API calls to GitHub
without exposing the GitHub API access token to the app.> ***NOTE***: This is intended to be an incredibly temporary solution, since the
> function has to request the access token from Auth0 _every request_. This
> means the app must wait for 3 API requests to resolve before it sees any data.
>
> To reduce the amount of requests, the access token could be cached by the
> proxy. Since this is a GCloud Function, any cache we create will not be
> persisted, so this code would have to be integrated into it's own stand
> alone server with a Redis instance or something to persist the data between
> requests.## How it works
1. The GCloud Function (further called the _proxy_), receives a GraphQL
query and an Auth0 access token via a POST request.
2. The proxy uses the Auth0 access token to request the corresponding GitHub
access token via the Auth0 Management API.
a. If the Auth0 request fails, the proxy echoes that failure back to the
requesting app.
3. Once the GitHub access token has been retrieved, the proxy forwards the
GraphQL query to the GitHub API, authenticating with the GitHub access
token.
4. The response recieved from GitHub is then forwarded back to the original
requestor.