jaredhanson / jaredhanson/passport-github
Nodejs Passportjs Reactjs CORS issue
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 535
- Forks
- 290
- PR merge metrics
- No merged PRs in 30d
Description
Dear All I am using github login for my react.js application with passport github2 strategy
**My React.js app is running on port 3000
and the Node.js server is running on port 5000**
This is error I am getting when I try to login with github, please see the screenshot

`Access to XMLHttpRequest at 'https://github.com/login/oauth/authorize?response_type=code&redirect_uri=http%3A%2F%2FXX.XX.71.24%3A5000%2Fapi%2Fv1%2Fauth%2Fgithub%2Fcallback&scope=user%3Aemail&client_id=f34f1df531540449d402' (redirected from 'http://XX.XX.71.24:3000/api/v1/auth/github') from origin 'http://XX.XX.71.24:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.`
CORS is enabled on my server as other endpoints are working fine
Here is the CORS settings

this my github app setting

Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the OAuth request from the React app at port 3000 through the Node.js server at port 5000 and reviewing the shown CORS settings. Compare the GitHub OAuth authorize URL, callback URL, and GitHub app settings in the issue. Done requires identifying the cause of the blocked authorization flow and confirming that GitHub login completes without the reported browser error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, javascript, nodejs, react
- Domain
- authentication, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100