Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
Yahoo.php
01 <?php
02
03 namespace OAuth\OAuth2\Service;
04
05 use OAuth\Common\Http\Exception\TokenResponseException;
06 use OAuth\Common\Http\Uri\Uri;
07 use OAuth\OAuth2\Token\StdOAuth2Token;
08
09 class Yahoo extends AbstractService
10 {
11 /**
12 * {@inheritdoc}
13 */
14 public function getAuthorizationEndpoint()
15 {
16 return new Uri('https://api.login.yahoo.com/oauth2/request_auth');
17 }
18
19 /**
20 * {@inheritdoc}
21 */
22 public function getAccessTokenEndpoint()
23 {
24 return new Uri('https://api.login.yahoo.com/oauth2/get_token');
25 }
26
27 /**
28 * {@inheritdoc}
29 */
30 protected function getAuthorizationMethod()
31 {
32 return static::AUTHORIZATION_METHOD_HEADER_BEARER;
33 }
34
35 /**
36 * {@inheritdoc}
37 */
38 protected function parseAccessTokenResponse($responseBody)
39 {
40 $data = json_decode($responseBody, true);
41
42 if (null === $data || !is_array($data)) {
43 throw new TokenResponseException('Unable to parse response.');
44 } elseif (isset($data['error'])) {
45 throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
46 }
47
48 $token = new StdOAuth2Token();
49 $token->setAccessToken($data['access_token']);
50 $token->setLifetime($data['expires_in']);
51
52 if (isset($data['refresh_token'])) {
53 $token->setRefreshToken($data['refresh_token']);
54 unset($data['refresh_token']);
55 }
56
57 unset($data['access_token'], $data['expires_in']);
58
59 $token->setExtraParams($data);
60
61 return $token;
62 }
63
64 /**
65 * {@inheritdoc}
66 */
67 protected function getExtraOAuthHeaders()
68 {
69 $encodedCredentials = base64_encode(
70 $this->credentials->getConsumerId() . ':' . $this->credentials->getConsumerSecret()
71 );
72
73 return ['Authorization' => 'Basic ' . $encodedCredentials];
74 }
75 }
76