CORs error when making get requests Github API
See original GitHub issueDescribe the issue I’m trying to authenticate over OAUTH API using Axios. The initial request is just a simple GET to get the auth token.
…from origin ‘http://localhost:3001’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
I can use an href link and it works totally fine. What could be the issue here?
Example Code
axios.get(
"https://github.com/login/oauth/authorize?client_id=$ID"
).then((res) => { console.log(res) })
Expected behavior, if applicable A clear and concise description of what you expected to happen.
Environment:
- Axios Version 0.19beta
- OS: OSX 10.13.4]
- Browser chrome
- Browser Version latest
- Additional Library Versions react Additional context/Screenshots Add any other context about the problem here. If applicable, add screenshots to help explain.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
GitHub API CORS Policy - Stack Overflow
I'm using jQuery and ajax to do a get request to the GitHub API but after I refresh about 3 ...
Read more >New to JavaScript? You'll Run Into This Annoying Error When ...
If you're new to JavaScript or web programming in general, it's inevitable that you're going to run into something called a CORS error,...
Read more >Fixing Common Problems with CORS and JavaScript
Tutorial: This post walks through troubleshooting and fixing common problems associated with calling REST APIs from JavaScript.
Read more >What Is a CORS Error and How to Fix It (3 Ways) - Bannerbear
A CORS error is common when making an HTTP request to another origin. You can get rid of it using one of the...
Read more >Cross-Origin Resource Sharing (CORS) - MDN Web Docs
For security reasons, browsers restrict cross-origin HTTP requests initiated from scripts. For example, XMLHttpRequest and the Fetch API ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Try to set headers in your HTTP request. See the example code
@moyid :
Could you please elaborate on this a bit more? Or url to an example would be great help. 😄