Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
google.php
1<?php
2
4
7
9{
10
11 protected function __construct()
12 {
13 $this->oauthEntity = new GoogleInterface;
14
15 $this->oauthEntity->addScope(array(
16 'email',
17 'https://mail.google.com/',
18 ));
19 }
20
21 protected function check()
22 {
23 $provider = new \CSocServGoogleOAuth;
24
25 return $provider->checkSettings();
26 }
27
28 protected function mapUserData(array $userData)
29 {
30 return array(
31 'email' => $userData['email'],
32 'first_name' => $userData['given_name'],
33 'last_name' => $userData['family_name'],
34 'full_name' => $userData['name'],
35 'image' => $userData['picture'],
36 'error' => $userData['error']['message'],
37 );
38 }
39
40 public static function getServiceName()
41 {
42 return 'google';
43 }
44
45 public function getControllerUrl()
46 {
47 return \CSocServAuth::getControllerUrl();
48 }
49
50}
51
52if (Main\Loader::includeModule('socialservices'))
53{
54 class GoogleInterface extends \CGoogleOAuthInterface
55 {
56
57 public function getStorageTokens()
58 {
59 return false;
60 }
61
62 public function getTokenData()
63 {
64 return array(
65 'access_token' => $this->access_token,
66 'refresh_token' => $this->refresh_token,
67 'expires_in' => $this->accessTokenExpires,
68 );
69 }
70
71 }
72}
mapUserData(array $userData)
Definition google.php:28