- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 6.2k
          Fix login with oauth2 sometimes return could not find a matching session for this request
          #32149
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ion for this request
could not find a matching session for this request
      |  | ||
| log.Error("OAuth2 Provider %s error(start BeginAuthHandler): %v", authSource.Name, err) | ||
| gothic.BeginAuthHandler(response, request) | ||
| return nil, goth.User{}, nil | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's really a hacky patch and I do not think it is right.
- Gitea never calls BeginAuthHandler directly
- It might cause infinite redirection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is from the official example https://github.com/markbates/goth/blob/master/examples/main.go#L250-L258 and I have tested it many times manually, and it works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, it is official, but it is not right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested it many times manually, and it works.
How did you test? What if your "test" is wrong.
| 
 I do not see how it fixes 27033 | 
| OK. This is a mistake. The real problem is users visiting a Gitea address which is not the one they input in the GitHub oauth2 application forms. | 
Try to fix #27033
#5551