We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentd8d4b9b commitd7ba6c0Copy full SHA for d7ba6c0
coderd/userauth.go
@@ -1096,7 +1096,10 @@ func (api *API) userOAuth2Github(rw http.ResponseWriter, r *http.Request) {
1096
}
1097
// If the user is logging in with github.com we update their associated
1098
// GitHub user ID to the new one.
1099
-ifexternalauth.IsGithubDotComURL(api.GithubOAuth2Config.AuthCodeURL(""))&&user.GithubComUserID.Int64!=ghUser.GetID() {
+// We use AuthCodeURL from the OAuth2Config field instead of the one on
1100
+// GithubOAuth2Config because when device flow is configured, AuthCodeURL
1101
+// is overridden and returns a value that doesn't pass the URL check.
1102
+ifexternalauth.IsGithubDotComURL(api.GithubOAuth2Config.OAuth2Config.AuthCodeURL(""))&&user.GithubComUserID.Int64!=ghUser.GetID() {
1103
err=api.Database.UpdateUserGithubComUserID(ctx, database.UpdateUserGithubComUserIDParams{
1104
ID:user.ID,
1105
GithubComUserID: sql.NullInt64{