| @@ 623-639 (lines=17) @@ | ||
| 620 | * @return string |
|
| 621 | * @throws TwitchException |
|
| 622 | */ |
|
| 623 | public function authLoginURL($scope) |
|
| 624 | { |
|
| 625 | if (count($this->config) === 0) { |
|
| 626 | $this->configException(); |
|
| 627 | } |
|
| 628 | ||
| 629 | $queryString = $this->helper->buildQueryString(array( |
|
| 630 | 'response_type' => 'code', |
|
| 631 | 'client_id' => $this->getConfigParam('client_id'), |
|
| 632 | 'redirect_uri' => $this->getConfigParam('redirect_uri'), |
|
| 633 | 'scope' => $scope, |
|
| 634 | )); |
|
| 635 | ||
| 636 | $auth = new Methods\Auth($this->request); |
|
| 637 | ||
| 638 | return $auth->getLoginURL($queryString); |
|
| 639 | } |
|
| 640 | ||
| 641 | /** |
|
| 642 | * Get authentication access token |
|
| @@ 647-664 (lines=18) @@ | ||
| 644 | * @return \stdClass |
|
| 645 | * @throws TwitchException |
|
| 646 | */ |
|
| 647 | public function authAccessTokenGet($code) |
|
| 648 | { |
|
| 649 | if (count($this->config) === 0) { |
|
| 650 | $this->configException(); |
|
| 651 | } |
|
| 652 | ||
| 653 | $queryString = $this->helper->buildQueryString(array( |
|
| 654 | 'client_id' => $this->getConfigParam('client_id'), |
|
| 655 | 'client_secret' => $this->getConfigParam('client_secret'), |
|
| 656 | 'grant_type' => 'authorization_code', |
|
| 657 | 'redirect_uri' => $this->getConfigParam('redirect_uri'), |
|
| 658 | 'code' => $code, |
|
| 659 | )); |
|
| 660 | ||
| 661 | $auth = new Methods\Auth($this->request); |
|
| 662 | ||
| 663 | return $auth->getAccessToken($queryString); |
|
| 664 | } |
|
| 665 | ||
| 666 | /** |
|
| 667 | * Get the authenticated user |
|