githubLogin.js
//append dotcom_user to the end of the GITHUB_PROFILE_URL, and then use that to run fetchGithubProfile to get specific user data
append dotcom_user to the end of the GITHUB_PROFILE_URL, and then use that to run fetchGithubProfile to get specific user data
append dotcom_user to the end of the GITHUB_PROFILE_URL and then use that to run fetchGithubProfile to get specific user data
async function fetchAccessTokens (code) {
  console.log('code')
  const reqHeader = await axios.post(GITHUB_TOKEN_URL, qs.stringify({
    code,
    client_id: '8fcf3e5c2d3d5dd78188',
    redirect_uri: 'http://127.0.0.1:8000',
    grant_type: 'authorization_code',
    client_secret: '0e102c56021e1aa28005b469b3c83ef7cb7e5b0e',
    scope: ['user:email','read:user']
  }), {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Set-Cookie': 'dotcom_user',
    },
  })
  console.log('reqheaders', reqHeader.headers);
  const response = await axios.post(GITHUB_TOKEN_URL, qs.stringify({
    code,
    client_id: '8fcf3e5c2d3d5dd78188',
    redirect_uri: 'http://127.0.0.1:8000',
    grant_type: 'authorization_code',
    client_secret: '0e102c56021e1aa28005b469b3c83ef7cb7e5b0e',
    scope: ['user:email','read:user']
  }), {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Set-Cookie': 'dotcom_user',
    },
  })
  console.log('inside fetchgithub token', JSON.stringify(response));
  return response
}
async function fetchAccessTokens ( code ) { console . log ( 'code' ) const reqHeader = await axios . post ( GITHUB_TOKEN_URL , qs . stringify ( { code , client_id : '8fcf3e5c2d3d5dd78188' , redirect_uri : 'http://127.0.0.1:8000' , grant_type : 'authorization_code' , client_secret : '0e102c56021e1aa28005b469b3c83ef7cb7e5b0e' , scope : [ 'user:email' , 'read:user' ] } ) , { headers : { 'Content-Type' : 'application/x-www-form-urlencoded' , 'Set-Cookie' : 'dotcom_user' , } , } ) console . log ( 'reqheaders' , reqHeader . headers ) ; const response = await axios . post ( GITHUB_TOKEN_URL , qs . stringify ( { code , client_id : '8fcf3e5c2d3d5dd78188' , redirect_uri : 'http://127.0.0.1:8000' , grant_type : 'authorization_code' , client_secret : '0e102c56021e1aa28005b469b3c83ef7cb7e5b0e' , scope : [ 'user:email' , 'read:user' ] } ) , { headers : { 'Content-Type' : 'application/x-www-form-urlencoded' , 'Set-Cookie' : 'dotcom_user' , } , } ) console . log ( 'inside fetchgithub token' , JSON . stringify ( response ) ) ; return response }
append dotcom_user to the end of the GITHUB_PROFILE_URL, and then use that to run fetchGithubProfile to get specific user data
append dotcom_user to the end of the GITHUB_PROFILE_URL and then use that to run fetchGithubProfile to get specific user data
//return response.data?