@@ -15,57 +15,57 @@ |
||
15 | 15 | */ |
16 | 16 | class PaypalOpenID extends OpenID |
17 | 17 | { |
18 | - /** |
|
19 | - * {@inheritdoc} |
|
20 | - */ |
|
21 | - protected $openidIdentifier = 'https://www.sandbox.paypal.com/webapps/auth/server'; |
|
18 | + /** |
|
19 | + * {@inheritdoc} |
|
20 | + */ |
|
21 | + protected $openidIdentifier = 'https://www.sandbox.paypal.com/webapps/auth/server'; |
|
22 | 22 | |
23 | - /** |
|
24 | - * {@inheritdoc} |
|
25 | - */ |
|
26 | - protected $apiDocumentation = 'https://developer.paypal.com/docs/connect-with-paypal/'; |
|
23 | + /** |
|
24 | + * {@inheritdoc} |
|
25 | + */ |
|
26 | + protected $apiDocumentation = 'https://developer.paypal.com/docs/connect-with-paypal/'; |
|
27 | 27 | |
28 | - /** |
|
29 | - * {@inheritdoc} |
|
30 | - */ |
|
31 | - public function authenticateBegin() |
|
32 | - { |
|
33 | - $this->openIdClient->identity = $this->openidIdentifier; |
|
34 | - $this->openIdClient->returnUrl = $this->callback; |
|
35 | - $this->openIdClient->required = [ |
|
36 | - 'namePerson/prefix', |
|
37 | - 'namePerson/first', |
|
38 | - 'namePerson/last', |
|
39 | - 'namePerson/middle', |
|
40 | - 'namePerson/suffix', |
|
41 | - 'namePerson/friendly', |
|
42 | - 'person/guid', |
|
43 | - 'birthDate/birthYear', |
|
44 | - 'birthDate/birthMonth', |
|
45 | - 'birthDate/birthday', |
|
46 | - 'gender', |
|
47 | - 'language/pref', |
|
48 | - 'contact/phone/default', |
|
49 | - 'contact/phone/home', |
|
50 | - 'contact/phone/business', |
|
51 | - 'contact/phone/cell', |
|
52 | - 'contact/phone/fax', |
|
53 | - 'contact/postaladdress/home', |
|
54 | - 'contact/postaladdressadditional/home', |
|
55 | - 'contact/city/home', |
|
56 | - 'contact/state/home', |
|
57 | - 'contact/country/home', |
|
58 | - 'contact/postalcode/home', |
|
59 | - 'contact/postaladdress/business', |
|
60 | - 'contact/postaladdressadditional/business', |
|
61 | - 'contact/city/business', |
|
62 | - 'contact/state/business', |
|
63 | - 'contact/country/business', |
|
64 | - 'contact/postalcode/business', |
|
65 | - 'company/name', |
|
66 | - 'company/title', |
|
67 | - ]; |
|
28 | + /** |
|
29 | + * {@inheritdoc} |
|
30 | + */ |
|
31 | + public function authenticateBegin() |
|
32 | + { |
|
33 | + $this->openIdClient->identity = $this->openidIdentifier; |
|
34 | + $this->openIdClient->returnUrl = $this->callback; |
|
35 | + $this->openIdClient->required = [ |
|
36 | + 'namePerson/prefix', |
|
37 | + 'namePerson/first', |
|
38 | + 'namePerson/last', |
|
39 | + 'namePerson/middle', |
|
40 | + 'namePerson/suffix', |
|
41 | + 'namePerson/friendly', |
|
42 | + 'person/guid', |
|
43 | + 'birthDate/birthYear', |
|
44 | + 'birthDate/birthMonth', |
|
45 | + 'birthDate/birthday', |
|
46 | + 'gender', |
|
47 | + 'language/pref', |
|
48 | + 'contact/phone/default', |
|
49 | + 'contact/phone/home', |
|
50 | + 'contact/phone/business', |
|
51 | + 'contact/phone/cell', |
|
52 | + 'contact/phone/fax', |
|
53 | + 'contact/postaladdress/home', |
|
54 | + 'contact/postaladdressadditional/home', |
|
55 | + 'contact/city/home', |
|
56 | + 'contact/state/home', |
|
57 | + 'contact/country/home', |
|
58 | + 'contact/postalcode/home', |
|
59 | + 'contact/postaladdress/business', |
|
60 | + 'contact/postaladdressadditional/business', |
|
61 | + 'contact/city/business', |
|
62 | + 'contact/state/business', |
|
63 | + 'contact/country/business', |
|
64 | + 'contact/postalcode/business', |
|
65 | + 'company/name', |
|
66 | + 'company/title', |
|
67 | + ]; |
|
68 | 68 | |
69 | - HttpClient\Util::redirect($this->openIdClient->authUrl()); |
|
70 | - } |
|
69 | + HttpClient\Util::redirect($this->openIdClient->authUrl()); |
|
70 | + } |
|
71 | 71 | } |
@@ -17,58 +17,58 @@ |
||
17 | 17 | */ |
18 | 18 | class Pinterest extends OAuth2 |
19 | 19 | { |
20 | - /** |
|
21 | - * {@inheritdoc} |
|
22 | - */ |
|
23 | - protected $scope = 'read_public'; |
|
20 | + /** |
|
21 | + * {@inheritdoc} |
|
22 | + */ |
|
23 | + protected $scope = 'read_public'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * {@inheritdoc} |
|
27 | - */ |
|
28 | - protected $apiBaseUrl = 'https://api.pinterest.com/v1/'; |
|
25 | + /** |
|
26 | + * {@inheritdoc} |
|
27 | + */ |
|
28 | + protected $apiBaseUrl = 'https://api.pinterest.com/v1/'; |
|
29 | 29 | |
30 | - /** |
|
31 | - * {@inheritdoc} |
|
32 | - */ |
|
33 | - protected $authorizeUrl = 'https://api.pinterest.com/oauth'; |
|
30 | + /** |
|
31 | + * {@inheritdoc} |
|
32 | + */ |
|
33 | + protected $authorizeUrl = 'https://api.pinterest.com/oauth'; |
|
34 | 34 | |
35 | - /** |
|
36 | - * {@inheritdoc} |
|
37 | - */ |
|
38 | - protected $accessTokenUrl = 'https://api.pinterest.com/v1/oauth/token'; |
|
35 | + /** |
|
36 | + * {@inheritdoc} |
|
37 | + */ |
|
38 | + protected $accessTokenUrl = 'https://api.pinterest.com/v1/oauth/token'; |
|
39 | 39 | |
40 | - /** |
|
41 | - * {@inheritdoc} |
|
42 | - */ |
|
43 | - protected $apiDocumentation = 'https://developers.pinterest.com/docs/api/overview/'; |
|
40 | + /** |
|
41 | + * {@inheritdoc} |
|
42 | + */ |
|
43 | + protected $apiDocumentation = 'https://developers.pinterest.com/docs/api/overview/'; |
|
44 | 44 | |
45 | - /** |
|
46 | - * {@inheritdoc} |
|
47 | - */ |
|
48 | - public function getUserProfile() |
|
49 | - { |
|
50 | - $response = $this->apiRequest('me'); |
|
45 | + /** |
|
46 | + * {@inheritdoc} |
|
47 | + */ |
|
48 | + public function getUserProfile() |
|
49 | + { |
|
50 | + $response = $this->apiRequest('me'); |
|
51 | 51 | |
52 | - $data = new Data\Collection($response); |
|
52 | + $data = new Data\Collection($response); |
|
53 | 53 | |
54 | - $data = $data->filter('data'); |
|
54 | + $data = $data->filter('data'); |
|
55 | 55 | |
56 | - if (!$data->exists('id')) { |
|
57 | - throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
58 | - } |
|
56 | + if (!$data->exists('id')) { |
|
57 | + throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
58 | + } |
|
59 | 59 | |
60 | - $userProfile = new User\Profile(); |
|
60 | + $userProfile = new User\Profile(); |
|
61 | 61 | |
62 | - $userProfile->identifier = $data->get('id'); |
|
63 | - $userProfile->description = $data->get('bio'); |
|
64 | - $userProfile->photoURL = $data->get('image'); |
|
65 | - $userProfile->displayName = $data->get('username'); |
|
66 | - $userProfile->firstName = $data->get('first_name'); |
|
67 | - $userProfile->lastName = $data->get('last_name'); |
|
68 | - $userProfile->profileURL = "https://pinterest.com/{$data->get('username')}"; |
|
62 | + $userProfile->identifier = $data->get('id'); |
|
63 | + $userProfile->description = $data->get('bio'); |
|
64 | + $userProfile->photoURL = $data->get('image'); |
|
65 | + $userProfile->displayName = $data->get('username'); |
|
66 | + $userProfile->firstName = $data->get('first_name'); |
|
67 | + $userProfile->lastName = $data->get('last_name'); |
|
68 | + $userProfile->profileURL = "https://pinterest.com/{$data->get('username')}"; |
|
69 | 69 | |
70 | - $userProfile->data = (array)$data->get('counts'); |
|
70 | + $userProfile->data = (array)$data->get('counts'); |
|
71 | 71 | |
72 | - return $userProfile; |
|
73 | - } |
|
72 | + return $userProfile; |
|
73 | + } |
|
74 | 74 | } |
@@ -12,127 +12,127 @@ |
||
12 | 12 | */ |
13 | 13 | class QQ extends OAuth2 |
14 | 14 | { |
15 | - /** |
|
16 | - * {@inheritdoc} |
|
17 | - */ |
|
18 | - protected $scope = 'get_user_info'; |
|
19 | - |
|
20 | - /** |
|
21 | - * {@inheritdoc} |
|
22 | - */ |
|
23 | - protected $apiBaseUrl = 'https://graph.qq.com/oauth2.0/'; |
|
24 | - |
|
25 | - /** |
|
26 | - * {@inheritdoc} |
|
27 | - */ |
|
28 | - protected $authorizeUrl = 'https://graph.qq.com/oauth2.0/authorize'; |
|
29 | - |
|
30 | - /** |
|
31 | - * {@inheritdoc} |
|
32 | - */ |
|
33 | - protected $accessTokenUrl = 'https://graph.qq.com/oauth2.0/token'; |
|
34 | - |
|
35 | - /** |
|
36 | - * {@ịnheritdoc} |
|
37 | - */ |
|
38 | - protected $accessTokenInfoUrl = 'https://graph.qq.com/oauth2.0/me'; |
|
39 | - |
|
40 | - /** |
|
41 | - * User Information Endpoint |
|
42 | - * @var string |
|
43 | - */ |
|
44 | - protected $accessUserInfo = 'https://graph.qq.com/user/get_user_info'; |
|
45 | - |
|
46 | - /** |
|
47 | - * {@inheritdoc} |
|
48 | - */ |
|
49 | - protected $tokenExchangeMethod = 'GET'; |
|
50 | - |
|
51 | - /** |
|
52 | - * {@inheritdoc} |
|
53 | - */ |
|
54 | - protected $tokenRefreshMethod = 'GET'; |
|
55 | - |
|
56 | - /** |
|
57 | - * {@inheritdoc} |
|
58 | - */ |
|
59 | - protected $apiDocumentation = ''; // Not available |
|
60 | - |
|
61 | - /** |
|
62 | - * {@inheritdoc} |
|
63 | - */ |
|
64 | - protected function initialize() |
|
65 | - { |
|
66 | - parent::initialize(); |
|
67 | - |
|
68 | - if ($this->isRefreshTokenAvailable()) { |
|
69 | - $this->tokenRefreshParameters += [ |
|
70 | - 'client_id' => $this->clientId, |
|
71 | - 'client_secret' => $this->clientSecret, |
|
72 | - ]; |
|
73 | - } |
|
74 | - |
|
75 | - $this->apiRequestParameters = [ |
|
76 | - 'access_token' => $this->getStoredData('access_token') |
|
77 | - ]; |
|
78 | - |
|
79 | - $this->apiRequestHeaders = []; |
|
80 | - } |
|
81 | - |
|
82 | - /** |
|
83 | - * {@inheritdoc} |
|
84 | - */ |
|
85 | - protected function validateAccessTokenExchange($response) |
|
86 | - { |
|
87 | - $collection = parent::validateAccessTokenExchange($response); |
|
88 | - |
|
89 | - $resp = $this->apiRequest($this->accessTokenInfoUrl); |
|
90 | - $resp = key($resp); |
|
91 | - |
|
92 | - $len = strlen($resp); |
|
93 | - $res = substr($resp, 10, $len - 14); |
|
94 | - |
|
95 | - $response = (new Data\Parser())->parse($res); |
|
96 | - |
|
97 | - if (!isset($response->openid)) { |
|
98 | - throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
99 | - } |
|
100 | - |
|
101 | - $this->storeData('openid', $response->openid); |
|
102 | - |
|
103 | - return $collection; |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * {@inheritdoc} |
|
108 | - */ |
|
109 | - public function getUserProfile() |
|
110 | - { |
|
111 | - $openid = $this->getStoredData('openid'); |
|
112 | - |
|
113 | - $userRequestParameters = [ |
|
114 | - 'oauth_consumer_key' => $this->clientId, |
|
115 | - 'openid' => $openid, |
|
116 | - 'format' => 'json' |
|
117 | - ]; |
|
118 | - |
|
119 | - $response = $this->apiRequest($this->accessUserInfo, 'GET', $userRequestParameters); |
|
120 | - |
|
121 | - $data = new Data\Collection($response); |
|
122 | - |
|
123 | - if ($data->get('ret') < 0) { |
|
124 | - throw new UnexpectedApiResponseException('Provider API returned an error: ' . $data->get('msg')); |
|
125 | - } |
|
126 | - |
|
127 | - $userProfile = new Profile(); |
|
128 | - |
|
129 | - $userProfile->identifier = $openid; |
|
130 | - $userProfile->displayName = $data->get('nickname'); |
|
131 | - $userProfile->photoURL = $data->get('figureurl_2'); |
|
132 | - $userProfile->gender = $data->get('gender'); |
|
133 | - $userProfile->region = $data->get('province'); |
|
134 | - $userProfile->city = $data->get('city'); |
|
135 | - |
|
136 | - return $userProfile; |
|
137 | - } |
|
15 | + /** |
|
16 | + * {@inheritdoc} |
|
17 | + */ |
|
18 | + protected $scope = 'get_user_info'; |
|
19 | + |
|
20 | + /** |
|
21 | + * {@inheritdoc} |
|
22 | + */ |
|
23 | + protected $apiBaseUrl = 'https://graph.qq.com/oauth2.0/'; |
|
24 | + |
|
25 | + /** |
|
26 | + * {@inheritdoc} |
|
27 | + */ |
|
28 | + protected $authorizeUrl = 'https://graph.qq.com/oauth2.0/authorize'; |
|
29 | + |
|
30 | + /** |
|
31 | + * {@inheritdoc} |
|
32 | + */ |
|
33 | + protected $accessTokenUrl = 'https://graph.qq.com/oauth2.0/token'; |
|
34 | + |
|
35 | + /** |
|
36 | + * {@ịnheritdoc} |
|
37 | + */ |
|
38 | + protected $accessTokenInfoUrl = 'https://graph.qq.com/oauth2.0/me'; |
|
39 | + |
|
40 | + /** |
|
41 | + * User Information Endpoint |
|
42 | + * @var string |
|
43 | + */ |
|
44 | + protected $accessUserInfo = 'https://graph.qq.com/user/get_user_info'; |
|
45 | + |
|
46 | + /** |
|
47 | + * {@inheritdoc} |
|
48 | + */ |
|
49 | + protected $tokenExchangeMethod = 'GET'; |
|
50 | + |
|
51 | + /** |
|
52 | + * {@inheritdoc} |
|
53 | + */ |
|
54 | + protected $tokenRefreshMethod = 'GET'; |
|
55 | + |
|
56 | + /** |
|
57 | + * {@inheritdoc} |
|
58 | + */ |
|
59 | + protected $apiDocumentation = ''; // Not available |
|
60 | + |
|
61 | + /** |
|
62 | + * {@inheritdoc} |
|
63 | + */ |
|
64 | + protected function initialize() |
|
65 | + { |
|
66 | + parent::initialize(); |
|
67 | + |
|
68 | + if ($this->isRefreshTokenAvailable()) { |
|
69 | + $this->tokenRefreshParameters += [ |
|
70 | + 'client_id' => $this->clientId, |
|
71 | + 'client_secret' => $this->clientSecret, |
|
72 | + ]; |
|
73 | + } |
|
74 | + |
|
75 | + $this->apiRequestParameters = [ |
|
76 | + 'access_token' => $this->getStoredData('access_token') |
|
77 | + ]; |
|
78 | + |
|
79 | + $this->apiRequestHeaders = []; |
|
80 | + } |
|
81 | + |
|
82 | + /** |
|
83 | + * {@inheritdoc} |
|
84 | + */ |
|
85 | + protected function validateAccessTokenExchange($response) |
|
86 | + { |
|
87 | + $collection = parent::validateAccessTokenExchange($response); |
|
88 | + |
|
89 | + $resp = $this->apiRequest($this->accessTokenInfoUrl); |
|
90 | + $resp = key($resp); |
|
91 | + |
|
92 | + $len = strlen($resp); |
|
93 | + $res = substr($resp, 10, $len - 14); |
|
94 | + |
|
95 | + $response = (new Data\Parser())->parse($res); |
|
96 | + |
|
97 | + if (!isset($response->openid)) { |
|
98 | + throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
99 | + } |
|
100 | + |
|
101 | + $this->storeData('openid', $response->openid); |
|
102 | + |
|
103 | + return $collection; |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * {@inheritdoc} |
|
108 | + */ |
|
109 | + public function getUserProfile() |
|
110 | + { |
|
111 | + $openid = $this->getStoredData('openid'); |
|
112 | + |
|
113 | + $userRequestParameters = [ |
|
114 | + 'oauth_consumer_key' => $this->clientId, |
|
115 | + 'openid' => $openid, |
|
116 | + 'format' => 'json' |
|
117 | + ]; |
|
118 | + |
|
119 | + $response = $this->apiRequest($this->accessUserInfo, 'GET', $userRequestParameters); |
|
120 | + |
|
121 | + $data = new Data\Collection($response); |
|
122 | + |
|
123 | + if ($data->get('ret') < 0) { |
|
124 | + throw new UnexpectedApiResponseException('Provider API returned an error: ' . $data->get('msg')); |
|
125 | + } |
|
126 | + |
|
127 | + $userProfile = new Profile(); |
|
128 | + |
|
129 | + $userProfile->identifier = $openid; |
|
130 | + $userProfile->displayName = $data->get('nickname'); |
|
131 | + $userProfile->photoURL = $data->get('figureurl_2'); |
|
132 | + $userProfile->gender = $data->get('gender'); |
|
133 | + $userProfile->region = $data->get('province'); |
|
134 | + $userProfile->city = $data->get('city'); |
|
135 | + |
|
136 | + return $userProfile; |
|
137 | + } |
|
138 | 138 | } |
@@ -17,56 +17,56 @@ |
||
17 | 17 | */ |
18 | 18 | class GitLab extends OAuth2 |
19 | 19 | { |
20 | - /** |
|
21 | - * {@inheritdoc} |
|
22 | - */ |
|
23 | - protected $scope = 'api'; |
|
20 | + /** |
|
21 | + * {@inheritdoc} |
|
22 | + */ |
|
23 | + protected $scope = 'api'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * {@inheritdoc} |
|
27 | - */ |
|
28 | - protected $apiBaseUrl = 'https://gitlab.com/api/v3/'; |
|
25 | + /** |
|
26 | + * {@inheritdoc} |
|
27 | + */ |
|
28 | + protected $apiBaseUrl = 'https://gitlab.com/api/v3/'; |
|
29 | 29 | |
30 | - /** |
|
31 | - * {@inheritdoc} |
|
32 | - */ |
|
33 | - protected $authorizeUrl = 'https://gitlab.com/oauth/authorize'; |
|
30 | + /** |
|
31 | + * {@inheritdoc} |
|
32 | + */ |
|
33 | + protected $authorizeUrl = 'https://gitlab.com/oauth/authorize'; |
|
34 | 34 | |
35 | - /** |
|
36 | - * {@inheritdoc} |
|
37 | - */ |
|
38 | - protected $accessTokenUrl = 'https://gitlab.com/oauth/token'; |
|
35 | + /** |
|
36 | + * {@inheritdoc} |
|
37 | + */ |
|
38 | + protected $accessTokenUrl = 'https://gitlab.com/oauth/token'; |
|
39 | 39 | |
40 | - /** |
|
41 | - * {@inheritdoc} |
|
42 | - */ |
|
43 | - protected $apiDocumentation = 'https://docs.gitlab.com/ee/api/oauth2.html'; |
|
40 | + /** |
|
41 | + * {@inheritdoc} |
|
42 | + */ |
|
43 | + protected $apiDocumentation = 'https://docs.gitlab.com/ee/api/oauth2.html'; |
|
44 | 44 | |
45 | - /** |
|
46 | - * {@inheritdoc} |
|
47 | - */ |
|
48 | - public function getUserProfile() |
|
49 | - { |
|
50 | - $response = $this->apiRequest('user'); |
|
45 | + /** |
|
46 | + * {@inheritdoc} |
|
47 | + */ |
|
48 | + public function getUserProfile() |
|
49 | + { |
|
50 | + $response = $this->apiRequest('user'); |
|
51 | 51 | |
52 | - $data = new Data\Collection($response); |
|
52 | + $data = new Data\Collection($response); |
|
53 | 53 | |
54 | - if (!$data->exists('id')) { |
|
55 | - throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
56 | - } |
|
54 | + if (!$data->exists('id')) { |
|
55 | + throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
56 | + } |
|
57 | 57 | |
58 | - $userProfile = new User\Profile(); |
|
58 | + $userProfile = new User\Profile(); |
|
59 | 59 | |
60 | - $userProfile->identifier = $data->get('id'); |
|
61 | - $userProfile->displayName = $data->get('name'); |
|
62 | - $userProfile->description = $data->get('bio'); |
|
63 | - $userProfile->photoURL = $data->get('avatar_url'); |
|
64 | - $userProfile->profileURL = $data->get('web_url'); |
|
65 | - $userProfile->email = $data->get('email'); |
|
66 | - $userProfile->webSiteURL = $data->get('website_url'); |
|
60 | + $userProfile->identifier = $data->get('id'); |
|
61 | + $userProfile->displayName = $data->get('name'); |
|
62 | + $userProfile->description = $data->get('bio'); |
|
63 | + $userProfile->photoURL = $data->get('avatar_url'); |
|
64 | + $userProfile->profileURL = $data->get('web_url'); |
|
65 | + $userProfile->email = $data->get('email'); |
|
66 | + $userProfile->webSiteURL = $data->get('website_url'); |
|
67 | 67 | |
68 | - $userProfile->displayName = $userProfile->displayName ?: $data->get('username'); |
|
68 | + $userProfile->displayName = $userProfile->displayName ?: $data->get('username'); |
|
69 | 69 | |
70 | - return $userProfile; |
|
71 | - } |
|
70 | + return $userProfile; |
|
71 | + } |
|
72 | 72 | } |
@@ -17,124 +17,124 @@ |
||
17 | 17 | */ |
18 | 18 | class Foursquare extends OAuth2 |
19 | 19 | { |
20 | - /** |
|
21 | - * {@inheritdoc} |
|
22 | - */ |
|
23 | - protected $apiBaseUrl = 'https://api.foursquare.com/v2/'; |
|
24 | - |
|
25 | - /** |
|
26 | - * {@inheritdoc} |
|
27 | - */ |
|
28 | - protected $authorizeUrl = 'https://foursquare.com/oauth2/authenticate'; |
|
29 | - |
|
30 | - /** |
|
31 | - * {@inheritdoc} |
|
32 | - */ |
|
33 | - protected $accessTokenUrl = 'https://foursquare.com/oauth2/access_token'; |
|
34 | - |
|
35 | - /** |
|
36 | - * {@inheritdoc} |
|
37 | - */ |
|
38 | - protected $accessTokenName = 'oauth_token'; |
|
39 | - |
|
40 | - /** |
|
41 | - * {@inheritdoc} |
|
42 | - */ |
|
43 | - protected $apiDocumentation = 'https://developer.foursquare.com/overview/auth'; |
|
44 | - |
|
45 | - /** |
|
46 | - * {@inheritdoc} |
|
47 | - */ |
|
48 | - protected function initialize() |
|
49 | - { |
|
50 | - parent::initialize(); |
|
51 | - |
|
52 | - $apiVersion = $this->config->get('api_version') ?: '20140201'; |
|
53 | - |
|
54 | - $this->apiRequestParameters = [ |
|
55 | - 'oauth_token' => $this->getStoredData('access_token'), |
|
56 | - 'v' => $apiVersion, |
|
57 | - ]; |
|
58 | - } |
|
59 | - |
|
60 | - /** |
|
61 | - * {@inheritdoc} |
|
62 | - */ |
|
63 | - public function getUserProfile() |
|
64 | - { |
|
65 | - $response = $this->apiRequest('users/self'); |
|
66 | - |
|
67 | - $data = new Data\Collection($response); |
|
68 | - |
|
69 | - if (!$data->exists('response')) { |
|
70 | - throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
71 | - } |
|
72 | - |
|
73 | - $userProfile = new User\Profile(); |
|
74 | - |
|
75 | - $data = $data->filter('response')->filter('user'); |
|
76 | - |
|
77 | - $userProfile->identifier = $data->get('id'); |
|
78 | - $userProfile->firstName = $data->get('firstName'); |
|
79 | - $userProfile->lastName = $data->get('lastName'); |
|
80 | - $userProfile->gender = $data->get('gender'); |
|
81 | - $userProfile->city = $data->get('homeCity'); |
|
82 | - $userProfile->email = $data->filter('contact')->get('email'); |
|
83 | - $userProfile->emailVerified = $userProfile->email; |
|
84 | - $userProfile->profileURL = 'https://www.foursquare.com/user/' . $userProfile->identifier; |
|
85 | - $userProfile->displayName = trim($userProfile->firstName . ' ' . $userProfile->lastName); |
|
86 | - |
|
87 | - if ($data->exists('photo')) { |
|
88 | - $photoSize = $this->config->get('photo_size') ?: '150x150'; |
|
89 | - |
|
90 | - $userProfile->photoURL = $data->filter('photo')->get('prefix'); |
|
91 | - $userProfile->photoURL .= $photoSize . $data->filter('photo')->get('suffix'); |
|
92 | - } |
|
93 | - |
|
94 | - return $userProfile; |
|
95 | - } |
|
96 | - |
|
97 | - /** |
|
98 | - * {@inheritdoc} |
|
99 | - */ |
|
100 | - public function getUserContacts() |
|
101 | - { |
|
102 | - $response = $this->apiRequest('users/self/friends'); |
|
103 | - |
|
104 | - $data = new Data\Collection($response); |
|
105 | - |
|
106 | - if (!$data->exists('response')) { |
|
107 | - throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
108 | - } |
|
109 | - |
|
110 | - $contacts = []; |
|
111 | - |
|
112 | - foreach ($data->filter('response')->filter('friends')->filter('items')->toArray() as $item) { |
|
113 | - $contacts[] = $this->fetchUserContact($item); |
|
114 | - } |
|
115 | - |
|
116 | - return $contacts; |
|
117 | - } |
|
118 | - |
|
119 | - /** |
|
120 | - * @param $item |
|
121 | - * |
|
122 | - * @return User\Contact |
|
123 | - */ |
|
124 | - protected function fetchUserContact($item) |
|
125 | - { |
|
126 | - $photoSize = $this->config->get('photo_size') ?: '150x150'; |
|
127 | - |
|
128 | - $item = new Data\Collection($item); |
|
129 | - |
|
130 | - $userContact = new User\Contact(); |
|
131 | - |
|
132 | - $userContact->identifier = $item->get('id'); |
|
133 | - $userContact->photoURL = $item->filter('photo')->get('prefix'); |
|
134 | - $userContact->photoURL .= $photoSize . $item->filter('photo')->get('suffix'); |
|
135 | - $userContact->displayName = trim($item->get('firstName') . ' ' . $item->get('lastName')); |
|
136 | - $userContact->email = $item->filter('contact')->get('email'); |
|
137 | - |
|
138 | - return $userContact; |
|
139 | - } |
|
20 | + /** |
|
21 | + * {@inheritdoc} |
|
22 | + */ |
|
23 | + protected $apiBaseUrl = 'https://api.foursquare.com/v2/'; |
|
24 | + |
|
25 | + /** |
|
26 | + * {@inheritdoc} |
|
27 | + */ |
|
28 | + protected $authorizeUrl = 'https://foursquare.com/oauth2/authenticate'; |
|
29 | + |
|
30 | + /** |
|
31 | + * {@inheritdoc} |
|
32 | + */ |
|
33 | + protected $accessTokenUrl = 'https://foursquare.com/oauth2/access_token'; |
|
34 | + |
|
35 | + /** |
|
36 | + * {@inheritdoc} |
|
37 | + */ |
|
38 | + protected $accessTokenName = 'oauth_token'; |
|
39 | + |
|
40 | + /** |
|
41 | + * {@inheritdoc} |
|
42 | + */ |
|
43 | + protected $apiDocumentation = 'https://developer.foursquare.com/overview/auth'; |
|
44 | + |
|
45 | + /** |
|
46 | + * {@inheritdoc} |
|
47 | + */ |
|
48 | + protected function initialize() |
|
49 | + { |
|
50 | + parent::initialize(); |
|
51 | + |
|
52 | + $apiVersion = $this->config->get('api_version') ?: '20140201'; |
|
53 | + |
|
54 | + $this->apiRequestParameters = [ |
|
55 | + 'oauth_token' => $this->getStoredData('access_token'), |
|
56 | + 'v' => $apiVersion, |
|
57 | + ]; |
|
58 | + } |
|
59 | + |
|
60 | + /** |
|
61 | + * {@inheritdoc} |
|
62 | + */ |
|
63 | + public function getUserProfile() |
|
64 | + { |
|
65 | + $response = $this->apiRequest('users/self'); |
|
66 | + |
|
67 | + $data = new Data\Collection($response); |
|
68 | + |
|
69 | + if (!$data->exists('response')) { |
|
70 | + throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
71 | + } |
|
72 | + |
|
73 | + $userProfile = new User\Profile(); |
|
74 | + |
|
75 | + $data = $data->filter('response')->filter('user'); |
|
76 | + |
|
77 | + $userProfile->identifier = $data->get('id'); |
|
78 | + $userProfile->firstName = $data->get('firstName'); |
|
79 | + $userProfile->lastName = $data->get('lastName'); |
|
80 | + $userProfile->gender = $data->get('gender'); |
|
81 | + $userProfile->city = $data->get('homeCity'); |
|
82 | + $userProfile->email = $data->filter('contact')->get('email'); |
|
83 | + $userProfile->emailVerified = $userProfile->email; |
|
84 | + $userProfile->profileURL = 'https://www.foursquare.com/user/' . $userProfile->identifier; |
|
85 | + $userProfile->displayName = trim($userProfile->firstName . ' ' . $userProfile->lastName); |
|
86 | + |
|
87 | + if ($data->exists('photo')) { |
|
88 | + $photoSize = $this->config->get('photo_size') ?: '150x150'; |
|
89 | + |
|
90 | + $userProfile->photoURL = $data->filter('photo')->get('prefix'); |
|
91 | + $userProfile->photoURL .= $photoSize . $data->filter('photo')->get('suffix'); |
|
92 | + } |
|
93 | + |
|
94 | + return $userProfile; |
|
95 | + } |
|
96 | + |
|
97 | + /** |
|
98 | + * {@inheritdoc} |
|
99 | + */ |
|
100 | + public function getUserContacts() |
|
101 | + { |
|
102 | + $response = $this->apiRequest('users/self/friends'); |
|
103 | + |
|
104 | + $data = new Data\Collection($response); |
|
105 | + |
|
106 | + if (!$data->exists('response')) { |
|
107 | + throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
108 | + } |
|
109 | + |
|
110 | + $contacts = []; |
|
111 | + |
|
112 | + foreach ($data->filter('response')->filter('friends')->filter('items')->toArray() as $item) { |
|
113 | + $contacts[] = $this->fetchUserContact($item); |
|
114 | + } |
|
115 | + |
|
116 | + return $contacts; |
|
117 | + } |
|
118 | + |
|
119 | + /** |
|
120 | + * @param $item |
|
121 | + * |
|
122 | + * @return User\Contact |
|
123 | + */ |
|
124 | + protected function fetchUserContact($item) |
|
125 | + { |
|
126 | + $photoSize = $this->config->get('photo_size') ?: '150x150'; |
|
127 | + |
|
128 | + $item = new Data\Collection($item); |
|
129 | + |
|
130 | + $userContact = new User\Contact(); |
|
131 | + |
|
132 | + $userContact->identifier = $item->get('id'); |
|
133 | + $userContact->photoURL = $item->filter('photo')->get('prefix'); |
|
134 | + $userContact->photoURL .= $photoSize . $item->filter('photo')->get('suffix'); |
|
135 | + $userContact->displayName = trim($item->get('firstName') . ' ' . $item->get('lastName')); |
|
136 | + $userContact->email = $item->filter('contact')->get('email'); |
|
137 | + |
|
138 | + return $userContact; |
|
139 | + } |
|
140 | 140 | } |
@@ -14,29 +14,29 @@ |
||
14 | 14 | */ |
15 | 15 | class StackExchangeOpenID extends OpenID |
16 | 16 | { |
17 | - /** |
|
18 | - * {@inheritdoc} |
|
19 | - */ |
|
20 | - protected $openidIdentifier = 'https://openid.stackexchange.com/'; |
|
21 | - |
|
22 | - /** |
|
23 | - * {@inheritdoc} |
|
24 | - */ |
|
25 | - protected $apiDocumentation = 'https://openid.stackexchange.com/'; |
|
26 | - |
|
27 | - /** |
|
28 | - * {@inheritdoc} |
|
29 | - */ |
|
30 | - public function authenticateFinish() |
|
31 | - { |
|
32 | - parent::authenticateFinish(); |
|
33 | - |
|
34 | - $userProfile = $this->storage->get($this->providerId . '.user'); |
|
35 | - |
|
36 | - $userProfile->identifier = !empty($userProfile->identifier) ? $userProfile->identifier : $userProfile->email; |
|
37 | - $userProfile->emailVerified = $userProfile->email; |
|
38 | - |
|
39 | - // re store the user profile |
|
40 | - $this->storage->set($this->providerId . '.user', $userProfile); |
|
41 | - } |
|
17 | + /** |
|
18 | + * {@inheritdoc} |
|
19 | + */ |
|
20 | + protected $openidIdentifier = 'https://openid.stackexchange.com/'; |
|
21 | + |
|
22 | + /** |
|
23 | + * {@inheritdoc} |
|
24 | + */ |
|
25 | + protected $apiDocumentation = 'https://openid.stackexchange.com/'; |
|
26 | + |
|
27 | + /** |
|
28 | + * {@inheritdoc} |
|
29 | + */ |
|
30 | + public function authenticateFinish() |
|
31 | + { |
|
32 | + parent::authenticateFinish(); |
|
33 | + |
|
34 | + $userProfile = $this->storage->get($this->providerId . '.user'); |
|
35 | + |
|
36 | + $userProfile->identifier = !empty($userProfile->identifier) ? $userProfile->identifier : $userProfile->email; |
|
37 | + $userProfile->emailVerified = $userProfile->email; |
|
38 | + |
|
39 | + // re store the user profile |
|
40 | + $this->storage->set($this->providerId . '.user', $userProfile); |
|
41 | + } |
|
42 | 42 | } |
@@ -38,70 +38,70 @@ |
||
38 | 38 | */ |
39 | 39 | class StackExchange extends OAuth2 |
40 | 40 | { |
41 | - /** |
|
42 | - * {@inheritdoc} |
|
43 | - */ |
|
44 | - protected $scope = null; |
|
45 | - |
|
46 | - /** |
|
47 | - * {@inheritdoc} |
|
48 | - */ |
|
49 | - protected $apiBaseUrl = 'https://api.stackexchange.com/2.2/'; |
|
50 | - |
|
51 | - /** |
|
52 | - * {@inheritdoc} |
|
53 | - */ |
|
54 | - protected $authorizeUrl = 'https://stackexchange.com/oauth'; |
|
55 | - |
|
56 | - /** |
|
57 | - * {@inheritdoc} |
|
58 | - */ |
|
59 | - protected $accessTokenUrl = 'https://stackexchange.com/oauth/access_token'; |
|
60 | - |
|
61 | - /** |
|
62 | - * {@inheritdoc} |
|
63 | - */ |
|
64 | - protected $apiDocumentation = 'https://api.stackexchange.com/docs/authentication'; |
|
65 | - |
|
66 | - /** |
|
67 | - * {@inheritdoc} |
|
68 | - */ |
|
69 | - protected function initialize() |
|
70 | - { |
|
71 | - parent::initialize(); |
|
72 | - |
|
73 | - $apiKey = $this->config->get('api_key'); |
|
74 | - |
|
75 | - $this->apiRequestParameters = ['key' => $apiKey]; |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * {@inheritdoc} |
|
80 | - */ |
|
81 | - public function getUserProfile() |
|
82 | - { |
|
83 | - $site = $this->config->get('site'); |
|
84 | - |
|
85 | - $response = $this->apiRequest('me', 'GET', [ |
|
86 | - 'site' => $site, |
|
87 | - 'access_token' => $this->getStoredData('access_token'), |
|
88 | - ]); |
|
89 | - |
|
90 | - if (!$response || !isset($response->items) || !isset($response->items[0])) { |
|
91 | - throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
92 | - } |
|
93 | - |
|
94 | - $data = new Data\Collection($response->items[0]); |
|
95 | - |
|
96 | - $userProfile = new User\Profile(); |
|
97 | - |
|
98 | - $userProfile->identifier = strval($data->get('user_id')); |
|
99 | - $userProfile->displayName = $data->get('display_name'); |
|
100 | - $userProfile->photoURL = $data->get('profile_image'); |
|
101 | - $userProfile->profileURL = $data->get('link'); |
|
102 | - $userProfile->region = $data->get('location'); |
|
103 | - $userProfile->age = $data->get('age'); |
|
104 | - |
|
105 | - return $userProfile; |
|
106 | - } |
|
41 | + /** |
|
42 | + * {@inheritdoc} |
|
43 | + */ |
|
44 | + protected $scope = null; |
|
45 | + |
|
46 | + /** |
|
47 | + * {@inheritdoc} |
|
48 | + */ |
|
49 | + protected $apiBaseUrl = 'https://api.stackexchange.com/2.2/'; |
|
50 | + |
|
51 | + /** |
|
52 | + * {@inheritdoc} |
|
53 | + */ |
|
54 | + protected $authorizeUrl = 'https://stackexchange.com/oauth'; |
|
55 | + |
|
56 | + /** |
|
57 | + * {@inheritdoc} |
|
58 | + */ |
|
59 | + protected $accessTokenUrl = 'https://stackexchange.com/oauth/access_token'; |
|
60 | + |
|
61 | + /** |
|
62 | + * {@inheritdoc} |
|
63 | + */ |
|
64 | + protected $apiDocumentation = 'https://api.stackexchange.com/docs/authentication'; |
|
65 | + |
|
66 | + /** |
|
67 | + * {@inheritdoc} |
|
68 | + */ |
|
69 | + protected function initialize() |
|
70 | + { |
|
71 | + parent::initialize(); |
|
72 | + |
|
73 | + $apiKey = $this->config->get('api_key'); |
|
74 | + |
|
75 | + $this->apiRequestParameters = ['key' => $apiKey]; |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * {@inheritdoc} |
|
80 | + */ |
|
81 | + public function getUserProfile() |
|
82 | + { |
|
83 | + $site = $this->config->get('site'); |
|
84 | + |
|
85 | + $response = $this->apiRequest('me', 'GET', [ |
|
86 | + 'site' => $site, |
|
87 | + 'access_token' => $this->getStoredData('access_token'), |
|
88 | + ]); |
|
89 | + |
|
90 | + if (!$response || !isset($response->items) || !isset($response->items[0])) { |
|
91 | + throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
92 | + } |
|
93 | + |
|
94 | + $data = new Data\Collection($response->items[0]); |
|
95 | + |
|
96 | + $userProfile = new User\Profile(); |
|
97 | + |
|
98 | + $userProfile->identifier = strval($data->get('user_id')); |
|
99 | + $userProfile->displayName = $data->get('display_name'); |
|
100 | + $userProfile->photoURL = $data->get('profile_image'); |
|
101 | + $userProfile->profileURL = $data->get('link'); |
|
102 | + $userProfile->region = $data->get('location'); |
|
103 | + $userProfile->age = $data->get('age'); |
|
104 | + |
|
105 | + return $userProfile; |
|
106 | + } |
|
107 | 107 | } |
@@ -17,49 +17,49 @@ |
||
17 | 17 | */ |
18 | 18 | class Blizzard extends OAuth2 |
19 | 19 | { |
20 | - /** |
|
21 | - * {@inheritdoc} |
|
22 | - */ |
|
23 | - protected $scope = ''; |
|
20 | + /** |
|
21 | + * {@inheritdoc} |
|
22 | + */ |
|
23 | + protected $scope = ''; |
|
24 | 24 | |
25 | - /** |
|
26 | - * {@inheritdoc} |
|
27 | - */ |
|
28 | - protected $apiBaseUrl = 'https://us.battle.net/'; |
|
25 | + /** |
|
26 | + * {@inheritdoc} |
|
27 | + */ |
|
28 | + protected $apiBaseUrl = 'https://us.battle.net/'; |
|
29 | 29 | |
30 | - /** |
|
31 | - * {@inheritdoc} |
|
32 | - */ |
|
33 | - protected $authorizeUrl = 'https://us.battle.net/oauth/authorize'; |
|
30 | + /** |
|
31 | + * {@inheritdoc} |
|
32 | + */ |
|
33 | + protected $authorizeUrl = 'https://us.battle.net/oauth/authorize'; |
|
34 | 34 | |
35 | - /** |
|
36 | - * {@inheritdoc} |
|
37 | - */ |
|
38 | - protected $accessTokenUrl = 'https://us.battle.net/oauth/token'; |
|
35 | + /** |
|
36 | + * {@inheritdoc} |
|
37 | + */ |
|
38 | + protected $accessTokenUrl = 'https://us.battle.net/oauth/token'; |
|
39 | 39 | |
40 | - /** |
|
41 | - * {@inheritdoc} |
|
42 | - */ |
|
43 | - protected $apiDocumentation = 'https://develop.battle.net/documentation'; |
|
40 | + /** |
|
41 | + * {@inheritdoc} |
|
42 | + */ |
|
43 | + protected $apiDocumentation = 'https://develop.battle.net/documentation'; |
|
44 | 44 | |
45 | - /** |
|
46 | - * {@inheritdoc} |
|
47 | - */ |
|
48 | - public function getUserProfile() |
|
49 | - { |
|
50 | - $response = $this->apiRequest('oauth/userinfo'); |
|
45 | + /** |
|
46 | + * {@inheritdoc} |
|
47 | + */ |
|
48 | + public function getUserProfile() |
|
49 | + { |
|
50 | + $response = $this->apiRequest('oauth/userinfo'); |
|
51 | 51 | |
52 | - $data = new Data\Collection($response); |
|
52 | + $data = new Data\Collection($response); |
|
53 | 53 | |
54 | - if (!$data->exists('id')) { |
|
55 | - throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
56 | - } |
|
54 | + if (!$data->exists('id')) { |
|
55 | + throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
56 | + } |
|
57 | 57 | |
58 | - $userProfile = new User\Profile(); |
|
58 | + $userProfile = new User\Profile(); |
|
59 | 59 | |
60 | - $userProfile->identifier = $data->get('id'); |
|
61 | - $userProfile->displayName = $data->get('battletag') ?: $data->get('login'); |
|
60 | + $userProfile->identifier = $data->get('id'); |
|
61 | + $userProfile->displayName = $data->get('battletag') ?: $data->get('login'); |
|
62 | 62 | |
63 | - return $userProfile; |
|
64 | - } |
|
63 | + return $userProfile; |
|
64 | + } |
|
65 | 65 | } |
@@ -17,58 +17,58 @@ |
||
17 | 17 | */ |
18 | 18 | class Dropbox extends OAuth2 |
19 | 19 | { |
20 | - /** |
|
21 | - * {@inheritdoc} |
|
22 | - */ |
|
23 | - protected $scope = 'account_info.read'; |
|
20 | + /** |
|
21 | + * {@inheritdoc} |
|
22 | + */ |
|
23 | + protected $scope = 'account_info.read'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * {@inheritdoc} |
|
27 | - */ |
|
28 | - protected $apiBaseUrl = 'https://api.dropbox.com/2/'; |
|
25 | + /** |
|
26 | + * {@inheritdoc} |
|
27 | + */ |
|
28 | + protected $apiBaseUrl = 'https://api.dropbox.com/2/'; |
|
29 | 29 | |
30 | - /** |
|
31 | - * {@inheritdoc} |
|
32 | - */ |
|
33 | - protected $authorizeUrl = 'https://www.dropbox.com/1/oauth2/authorize'; |
|
30 | + /** |
|
31 | + * {@inheritdoc} |
|
32 | + */ |
|
33 | + protected $authorizeUrl = 'https://www.dropbox.com/1/oauth2/authorize'; |
|
34 | 34 | |
35 | - /** |
|
36 | - * {@inheritdoc} |
|
37 | - */ |
|
38 | - protected $accessTokenUrl = 'https://api.dropbox.com/1/oauth2/token'; |
|
35 | + /** |
|
36 | + * {@inheritdoc} |
|
37 | + */ |
|
38 | + protected $accessTokenUrl = 'https://api.dropbox.com/1/oauth2/token'; |
|
39 | 39 | |
40 | - /** |
|
41 | - * {@inheritdoc} |
|
42 | - */ |
|
43 | - protected $apiDocumentation = 'https://www.dropbox.com/developers/documentation/http/documentation'; |
|
40 | + /** |
|
41 | + * {@inheritdoc} |
|
42 | + */ |
|
43 | + protected $apiDocumentation = 'https://www.dropbox.com/developers/documentation/http/documentation'; |
|
44 | 44 | |
45 | - /** |
|
46 | - * {@inheritdoc} |
|
47 | - */ |
|
48 | - public function getUserProfile() |
|
49 | - { |
|
50 | - $response = $this->apiRequest('users/get_current_account', 'POST', [], [], true); |
|
45 | + /** |
|
46 | + * {@inheritdoc} |
|
47 | + */ |
|
48 | + public function getUserProfile() |
|
49 | + { |
|
50 | + $response = $this->apiRequest('users/get_current_account', 'POST', [], [], true); |
|
51 | 51 | |
52 | - $data = new Data\Collection($response); |
|
52 | + $data = new Data\Collection($response); |
|
53 | 53 | |
54 | - if (!$data->exists('account_id') || !$data->get('account_id')) { |
|
55 | - throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
56 | - } |
|
54 | + if (!$data->exists('account_id') || !$data->get('account_id')) { |
|
55 | + throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); |
|
56 | + } |
|
57 | 57 | |
58 | - $userProfile = new User\Profile(); |
|
58 | + $userProfile = new User\Profile(); |
|
59 | 59 | |
60 | - $userProfile->identifier = $data->get('account_id'); |
|
61 | - $userProfile->displayName = $data->filter('name')->get('display_name'); |
|
62 | - $userProfile->firstName = $data->filter('name')->get('given_name'); |
|
63 | - $userProfile->lastName = $data->filter('name')->get('surname'); |
|
64 | - $userProfile->email = $data->get('email'); |
|
65 | - $userProfile->photoURL = $data->get('profile_photo_url'); |
|
66 | - $userProfile->language = $data->get('locale'); |
|
67 | - $userProfile->country = $data->get('country'); |
|
68 | - if ($data->get('email_verified')) { |
|
69 | - $userProfile->emailVerified = $data->get('email'); |
|
70 | - } |
|
60 | + $userProfile->identifier = $data->get('account_id'); |
|
61 | + $userProfile->displayName = $data->filter('name')->get('display_name'); |
|
62 | + $userProfile->firstName = $data->filter('name')->get('given_name'); |
|
63 | + $userProfile->lastName = $data->filter('name')->get('surname'); |
|
64 | + $userProfile->email = $data->get('email'); |
|
65 | + $userProfile->photoURL = $data->get('profile_photo_url'); |
|
66 | + $userProfile->language = $data->get('locale'); |
|
67 | + $userProfile->country = $data->get('country'); |
|
68 | + if ($data->get('email_verified')) { |
|
69 | + $userProfile->emailVerified = $data->get('email'); |
|
70 | + } |
|
71 | 71 | |
72 | - return $userProfile; |
|
73 | - } |
|
72 | + return $userProfile; |
|
73 | + } |
|
74 | 74 | } |