jaredhanson / jaredhanson/passport-github

Nodejs Passportjs Reactjs CORS issue

Open
#73 1 comment 7 reactions 0 assignees View on GitHub

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

![image](https://user-images.githubusercontent.com/53823645/63324442-86996080-c341-11e9-81d3-e0d854f55d74.png)

`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

![image](https://user-images.githubusercontent.com/53823645/63324472-95801300-c341-11e9-81d0-0bbc92cab608.png)

this my github app setting

![image](https://user-images.githubusercontent.com/53823645/63324491-9d3fb780-c341-11e9-877b-2da8f75d99da.png)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.