1 | <?php |
||
35 | class OAuth |
||
36 | { |
||
37 | /** |
||
38 | * An instance of the League OAuth Client Provider. |
||
39 | * |
||
40 | * @var AbstractProvider |
||
41 | */ |
||
42 | protected $provider = null; |
||
43 | |||
44 | /** |
||
45 | * The current OAuth access token. |
||
46 | * |
||
47 | * @var AccessToken |
||
48 | */ |
||
49 | protected $oauthToken = null; |
||
50 | |||
51 | /** |
||
52 | * The user's email address, usually used as the login ID |
||
53 | * and also the from address when sending email. |
||
54 | * |
||
55 | * @var string |
||
56 | */ |
||
57 | protected $oauthUserEmail = ''; |
||
58 | |||
59 | /** |
||
60 | * The client secret, generated in the app definition of the service you're connecting to. |
||
61 | * |
||
62 | * @var string |
||
63 | */ |
||
64 | protected $oauthClientSecret = ''; |
||
65 | |||
66 | /** |
||
67 | * The client ID, generated in the app definition of the service you're connecting to. |
||
68 | * |
||
69 | * @var string |
||
70 | */ |
||
71 | protected $oauthClientId = ''; |
||
72 | |||
73 | /** |
||
74 | * The refresh token, used to obtain new AccessTokens. |
||
75 | * |
||
76 | * @var string |
||
77 | */ |
||
78 | protected $oauthRefreshToken = ''; |
||
79 | |||
80 | /** |
||
81 | * OAuth constructor. |
||
82 | * |
||
83 | * @param array $options Associative array containing |
||
84 | * `provider`, `userName`, `clientSecret`, `clientId` and `refreshToken` elements |
||
85 | */ |
||
86 | public function __construct($options) |
||
94 | |||
95 | /** |
||
96 | * Get a new RefreshToken. |
||
97 | * |
||
98 | * @return RefreshToken |
||
99 | */ |
||
100 | protected function getGrant() |
||
104 | |||
105 | /** |
||
106 | * Get a new AccessToken. |
||
107 | * |
||
108 | * @return AccessToken |
||
109 | */ |
||
110 | protected function getToken() |
||
117 | |||
118 | /** |
||
119 | * Generate a base64-encoded OAuth token. |
||
120 | * |
||
121 | * @return string |
||
122 | */ |
||
123 | public function getOauth64() |
||
138 | } |
||
139 |