Skip to content

Commit 85adb94

Browse files
Dylan William Hardisonglobau
authored andcommitted
Bug 1180733 - "An invalid state parameter was passed to the GitHub OAuth2 callback" error when logging in with github
1 parent 77fbf1e commit 85adb94

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

extensions/GitHubAuth/lib/Client.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ sub get_email_key {
6060
my $digest = Digest->new(DIGEST_HASH);
6161
$digest->add($email);
6262
$digest->add(remote_ip());
63-
$digest->add($cgi->cookie('Bugzilla_github_token') // '');
63+
$digest->add($cgi->cookie('Bugzilla_github_token') // Bugzilla->request_cache->{github_token} // '');
6464
$digest->add(Bugzilla->localconfig->{site_wide_secret});
6565
return $digest->hexdigest;
6666
}
@@ -85,7 +85,7 @@ sub get_state {
8585
my $digest = Digest->new(DIGEST_HASH);
8686
$digest->add($sorted_target->as_string);
8787
$digest->add(remote_ip());
88-
$digest->add($cgi->cookie('Bugzilla_github_token') // '');
88+
$digest->add($cgi->cookie('Bugzilla_github_token') // Bugzilla->request_cache->{github_token} // '');
8989
$digest->add(Bugzilla->localconfig->{site_wide_secret});
9090
return $digest->hexdigest;
9191
}

extensions/GitHubAuth/lib/Login.pm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ sub get_login_info {
3333

3434
my $cookie = $cgi->cookie('Bugzilla_github_token');
3535
unless ($cookie) {
36+
my $token = generate_random_password();
3637
$cgi->send_cookie(-name => 'Bugzilla_github_token',
37-
-value => generate_random_password(),
38+
-value => $token,
3839
Bugzilla->params->{'ssl_redirect'} ? ( -secure => 1 ) : (),
3940
-httponly => 1);
41+
Bugzilla->request_cache->{github_token} = $token;
4042
}
4143

4244
return { failure => AUTH_NODATA } unless $github_login;

0 commit comments

Comments
 (0)