You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// if (!isset($this->serviceTypes[$serviceType])) {
41
-
// throw new OAuthClientException(sprintf('Failed starting OAuth2 authorization, because the given service type "%s" is unknown.', $serviceType), 1511187873921);
42
-
// }
43
-
//
44
-
// $client = new $this->serviceTypes[$serviceName]($serviceName);
thrownewOAuthClientException(sprintf('Failed starting OAuth2 authorization, because the given service type "%s" is unknown.', $serviceType), 1511187873921);
thrownewOAuthClientException(sprintf('OAuth: Failed finishing OAuth2 authorization because the given service type "%s" is unknown.', $serviceName), 1511193117184);
@@ -69,7 +76,7 @@ public function finishAuthorizationAction(string $serviceType, string $serviceNa
69
76
if (!$clientinstanceof OAuthClient) {
70
77
thrownewOAuthClientException(sprintf('OAuth: Failed finishing authorization because of unexpected class type: "%s" must implement %s.', get_class($client), OAuthClient::class), 1568735389);
@@ -307,6 +309,7 @@ public function finishAuthorization(string $stateIdentifier, string $code): UriI
307
309
$this->logger->info(sprintf('OAuth (%s): Persisting OAuth token for authorization "%s" with expiry time %s.', $this->getServiceType(), $authorizationId, $accessToken->getExpires()));
308
310
309
311
$authorization->setAccessToken($accessToken);
312
+
$authorization->setScope($scope);
310
313
311
314
$this->entityManager->persist($authorization);
312
315
$this->entityManager->flush();
@@ -368,87 +371,60 @@ public function getAuthorization(string $authorizationId): ?Authorization
368
371
}
369
372
370
373
/**
371
-
* Returns a prepared request which provides the needed header for OAuth authentication
374
+
* Returns a prepared request to an OAuth 2.0 service provider using Bearer token authentication
372
375
*
376
+
* @param Authorization $authorization
373
377
* @param string $relativeUri A relative URI of the web server, prepended by the base URI
374
378
* @param string $method The HTTP method, for example "GET" or "POST"
375
379
* @param array $bodyFields Associative array of body fields to send (optional)
$this->logger->info(sprintf('OAuth (%s): Persisted new OAuth token for client "%s" with expiry time %s.', $this->getServiceType(), $oAuthToken->clientId, $newAccessToken->getExpires()));
407
-
408
-
$this->entityManager->persist($oAuthToken);
409
-
$this->entityManager->flush();
410
-
break;
411
-
}
385
+
$accessToken = $authorization->getAccessToken();
386
+
if ($accessToken === null) {
387
+
thrownewOAuthClientException(sprintf($this->getServiceType() . 'Failed getting an authenticated request for client ID "%s" because the authorization contained no access token', $authorization->getClientId()), 1589300319);
0 commit comments