I'm using token which gives me the email of GitHub users but still some of them shows me null.
I also tried my own GitHub account but get email:null.
I also set my email to public in Github profile still it gives me null.
After that I tried to use client-id and secret_key but then the request gets failed.
If i can get these emails through client-id and secret_key please tell me how to use this in my header. (as shown in comment)
export const fetchingGithubUserProfile = (GithubUsername) => {
const REQUEST = `https://api.github.com/users/${GithubUsername}`
const client_id = 'xxxxxxxxxxxxxx'
const client_secret = 'xxxxxxxxxxxxxxxxx';
var config = {
headers: {
'Authorization': 'token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx '
// "Authorization": "token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + btoa(client_id + ':' +
client_secret),
// 'ID' : 'Client ID e711e8d32ba8aea7c60f',
// 'Secret' : 'Client Secret b52543a7c2090f6a10725ac75f2dec03fbe4e2c9',
}
}
return dispatch => {
axios.get(REQUEST,config)
.then(res => {
dispatch(fetchedGithubUserProfileSuccess(res.data))
})
.catch(err => {
console.log(err)
})
}
}