git clone https://github.com/Octobay/api octobay-api && cd octobay-api && yarn && cp .env.sample .env
Add your GitHub OAuth app credentials and a personal access token to the .env
file and run yarn start
.
GitHub Personal Access Token
### Get a GitHub Personal Access TokenFollow these instructions to get your GitHub Personal Access Token.
Create the token with the following permissions:
- public_repo
- user:email
Put this personal access token in the .env file for the GITHUB_PERSONAL_ACCESS_TOKEN
variable.
Authorization Access Token
Our frontend and some backend calls (like is-repo-admin) expects an GitHub OAuth2 token.
Let's get you a token.
First create an OAuth2 Github app. Go to Settings -> Developer settings -> OAuth Apps
Set callback url to:
Application Name: anything
Homepage url: could be anything, but just do https://octobay.uber.space/
Authorization callback URL: MUST be http://localhost:3000/auth/github
Create the application.
In .env
, set the following to your OAuth2 apps information:
GITHUB_CLIENT_ID=<YOUR_GITHUB_CLIENT_ID>
GITHUB_CLIENT_SECRET=<YOUR_GITHUB_CLIENT_SECRET>
Set the following parameters in the app frontend
API_URL=http://localhost:3001
GITHUB_CLIENT_ID=<THE CLIENT ID OF THE OUATH2 APP YOU CREATED IN STEP 1>
Boot the api and app, and follow the login on the frontend.
You should now have an OAuth2 token beginning with gho_
in you Applications -> Local Storage.
Use this with a header of Authorization : Bearer <YOUR TOKEN>
to make authenticated API calls.
The auth code from https://github.com/login/oauth/authorize
can be exchanged for an access token here.
POST /github/access-token
Parameter | Default | Description |
---|---|---|
code |
null |
The auth code from the GitHub redirect. |
Code | Type | Description |
---|---|---|
200 | String |
The GitHub user's access token. |
500 | Object |
The error object. The code was probably wrong or expired. |
User
Get a user by username.
GET /github/user/:username
Parameter | Default | Description |
---|---|---|
username |
null |
A GitHub username. |
Code | Type | Description |
---|---|---|
200 | Object |
The GitHub user's account data. |
404 | Object |
User not found. |
500 | Object |
GitHub error. |
Issues
Get all issues that are currently indexed in the OctoBay subgraph. Results are cached.
GET /graph/issues
Parameter | Default | Description |
---|---|---|
filter |
null |
(Not yet implemented yet) |
order |
desc |
(Not yet implemented yet) |
orderBy |
depositSize |
(Not yet implemented yet) |
Code | Type | Description |
---|---|---|
200 | Array |
An array of issues/bounties. |
500 | Object |
The error object. Calling the graph endpoint failed. |