Skip to content
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: 2 additions & 1 deletion src/decorators/GithubContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from 'react'
import PropTypes from 'prop-types'
import request from 'axios'
import NextGlobalClientStore from '../modules/NextGlobalClientStore'
const GITHUB_API_URL = process.env.GITHUB_API_URL || 'https://api.github.com'

const getGithubAccessToken = req => {
if (process.browser) {
Expand All @@ -27,7 +28,7 @@ const getGithubUser = async githubAccessToken => {
return NextGlobalClientStore.get('githubUser')
}

const url = `https://api.github.com/user`
const url = `${GITHUB_API_URL}/user`
const headers = { Authorization: `token ${githubAccessToken}` }
const options = { headers }

Expand Down
3 changes: 2 additions & 1 deletion src/modules/getGithubAuthorizeUrl.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const githubAuthorizeUrl = 'https://github.com/login/oauth/authorize'
const GITHUB_URL = process.env.GITHUB_URL || 'https://github.com'
const githubAuthorizeUrl = `${GITHUB_URL}/login/oauth/authorize`

const queryStringFromObj = queryObj =>
Object.keys(queryObj)
Expand Down
3 changes: 2 additions & 1 deletion src/pages/SignIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import getGithubAccessTokenCookie from '../modules/getGithubAccessTokenCookie'
import getGithubAuthorizeUrl from '../modules/getGithubAuthorizeUrl'
import PublicPage from '../decorators/PublicPage'

const githubAccessTokenUrl = 'https://github.com/login/oauth/access_token'
const GITHUB_URL = process.env.GITHUB_URL || 'https://github.com'
const githubAccessTokenUrl = `${GITHUB_URL}/login/oauth/access_token`
const githubClientSecret = demandEnvVar('GITHUB_CLIENT_SECRET')

const fetchGithubAccessToken = async (githubAuthCode, githubClientId) => {
Expand Down