diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..e0c7345 --- /dev/null +++ b/.env.sample @@ -0,0 +1,3 @@ +DATABASE_URL="127.0.0.1:5432" +GITHUB_CLIENT_ID="[INSERT_CLIENT_ID]" +GITHUB_CLIENT_SECRET="[INSERT_CLIENT_SECRET]" \ No newline at end of file diff --git a/app/services/github.js b/app/services/github.js index 9d9e1be..ba979ce 100644 --- a/app/services/github.js +++ b/app/services/github.js @@ -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; diff --git a/docs/USER_GUIDE.md b/docs/USER_GUIDE.md index e9139ac..7e6d406 100644 --- a/docs/USER_GUIDE.md +++ b/docs/USER_GUIDE.md @@ -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. ## GitHub OAuth Apps