Merge branch '5.4'
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 27 Jul 2021 15:25:21 +0000 (17:25 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 27 Jul 2021 15:25:21 +0000 (17:25 +0200)
1  2 
wcfsetup/install/files/lib/action/AbstractOauth2Action.class.php
wcfsetup/install/lang/de.xml

index f03c2fc019a199515a76d6a5c4b7c6e16147f007,5ac9397644681de05234faff70a6de689a7230d7..b837e90b735a53c6fbe9ca27cfa9982e378db801
@@@ -137,8 -145,21 +145,21 @@@ abstract class AbstractOauth2Action ext
              'client_id' => $this->getClientId(),
              'client_secret' => $this->getClientSecret(),
              'redirect_uri' => $this->getCallbackUrl(),
 -            'code' => $_GET['code'],
 +            'code' => $code,
-         ], '', '&', \PHP_QUERY_RFC1738));
+         ];
+         if ($this->usePkce()) {
+             if (!($verifier = WCF::getSession()->getVar(self::PKCE))) {
+                 throw new StateValidationException('Missing PKCE verifier in session');
+             }
+             $payload['code_verifier'] = $verifier;
+         }
+         $request = new Request('POST', $this->getTokenEndpoint(), [
+             'Accept' => 'application/json',
+             'Content-Type' => 'application/x-www-form-urlencoded',
+         ], \http_build_query($payload, '', '&', \PHP_QUERY_RFC1738));
  
          try {
              $response = $this->getHttpClient()->send($request);
Simple merge