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

Change to github header auth as param auth is deprecated #26

Open
wants to merge 1 commit 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
2 changes: 1 addition & 1 deletion app/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = (sequelize, DataTypes) => {
const User = sequelize.define(
"User",
{
username: { type: DataTypes.STRING, unqiue: true, allowNull: false },
username: { type: DataTypes.STRING, unique: true, allowNull: false },
avatar_url: DataTypes.STRING,
github_id: DataTypes.STRING
},
Expand Down
7 changes: 4 additions & 3 deletions app/services/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@ class GitHub {

async get(route_url, params = {}) {
const url = api_url + route_url;
params["access_token"] = this.access_token;
const config = { headers: { Authorization: 'token ' + this.access_token },
params: params };

const response = await axios.get(url, { params });
const response = await axios.get(url, config);
return response.data;
}

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