Skip to content
This repository has been archived by the owner. It is now read-only.

Update the Github OAuth access token passing method #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DATABASE_URL="127.0.0.1:5432"
GITHUB_CLIENT_ID="[INSERT_CLIENT_ID]"
GITHUB_CLIENT_SECRET="[INSERT_CLIENT_SECRET]"
2 changes: 1 addition & 1 deletion app/services/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class GitHub {
static async get_user_from_token(access_token) {
/* Fetch user data using the access token. */
const url = api_url + "/user";
const config = { params: { access_token: access_token } };
const config = { headers : {'Authorization' : `token ${access_token}` }};

const response = await axios.get(url, config);
return response.data;
Expand Down
6 changes: 6 additions & 0 deletions docs/USER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ const user = await User.findAll({ where: { username: "octocat" } });
console.log(user);
```

To initialize the database schema, run

```
$ npx sequelize-cli db:migrate
```

This gives us flexibility in our database layer and keeps our JavaScript code clean of SQL commands. The data models located in the `/models` directory each use the `Sequelize` library.

## <a name='github-oauth'>GitHub OAuth Apps</a>
Expand Down