简体   繁体   中英

Can't authenticate to exceed Github api rate limit in React App

I'm trying to axios.get repos from most popular users on Github. The problem is I can't get past rate limit using OAuth token. error message

const headers = {
"Authorization" : `token ${process.env.REACT_APP_API_KEY}`,
'User-Agent': 'kiknalex'}

const userRepos = (reposUrl) => {
const request = axios.get(reposUrl);
return request.then(response => response.data, {
    "headers": headers
})}

But it gives me this error Response Headers

I've also tried to authenticate using curl,but it didn't work. How do I authenticate with OAuth token properly, or is there any other way to make rate limit higher.

Update: Apparently I "sent" headers in the response, it should be in get request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM