1 | <?php |
||
11 | class InktaleOAuth |
||
12 | { |
||
13 | /** @var OAuthStateStorageInterface */ |
||
14 | private $stateStorage; |
||
15 | |||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | public $clientId; |
||
20 | |||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | public $clientSecret; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | public $redirectUri; |
||
30 | |||
31 | /** |
||
32 | * @var InktaleOAuthApiClient |
||
33 | */ |
||
34 | private $apiClient; |
||
35 | |||
36 | /** |
||
37 | * InktaleOAuth constructor. |
||
38 | * @param OAuthStateStorageInterface $stateStorage |
||
39 | * @param InktaleOAuthApiClient $apiClient |
||
40 | * @param string $clientId Inktale app id |
||
41 | * @param string $clientSecret App's client secret |
||
42 | * @param string $redirectUri Redirect after permissions granted |
||
43 | */ |
||
44 | public function __construct( |
||
57 | |||
58 | /** |
||
59 | * Retrieve a URL where user should be redirected to authorize app |
||
60 | * |
||
61 | * @return string |
||
62 | */ |
||
63 | public function getAuthUrl() |
||
76 | |||
77 | /** |
||
78 | * @param $code |
||
79 | * @param $state |
||
80 | * @throws InktaleOAuthException |
||
81 | */ |
||
82 | public function getApiKey($code, $state) |
||
114 | } |
||
115 |