| @@ 612-628 (lines=17) @@ | ||
| 609 | * @return string |
|
| 610 | * @throws TwitchException |
|
| 611 | */ |
|
| 612 | public function authLoginURL($scope) |
|
| 613 | { |
|
| 614 | if ($this->authConfig === false) { |
|
| 615 | $this->authConfigException(); |
|
| 616 | } |
|
| 617 | ||
| 618 | $queryString = $this->helper->buildQueryString(array( |
|
| 619 | 'response_type' => 'code', |
|
| 620 | 'client_id' => $this->authConfig['client_id'], |
|
| 621 | 'redirect_uri' => $this->authConfig['redirect_uri'], |
|
| 622 | 'scope' => $scope, |
|
| 623 | )); |
|
| 624 | ||
| 625 | $auth = new Methods\Auth; |
|
| 626 | ||
| 627 | return $auth->getLoginURL($queryString); |
|
| 628 | } |
|
| 629 | ||
| 630 | /** |
|
| 631 | * Get authentication access token |
|
| @@ 636-653 (lines=18) @@ | ||
| 633 | * @return \stdClass |
|
| 634 | * @throws TwitchException |
|
| 635 | */ |
|
| 636 | public function authAccessTokenGet($code) |
|
| 637 | { |
|
| 638 | if ($this->authConfig === false) { |
|
| 639 | $this->authConfigException(); |
|
| 640 | } |
|
| 641 | ||
| 642 | $queryString = $this->helper->buildQueryString(array( |
|
| 643 | 'client_id' => $this->authConfig['client_id'], |
|
| 644 | 'client_secret' => $this->authConfig['client_secret'], |
|
| 645 | 'grant_type' => 'authorization_code', |
|
| 646 | 'redirect_uri' => $this->authConfig['redirect_uri'], |
|
| 647 | 'code' => $code, |
|
| 648 | )); |
|
| 649 | ||
| 650 | $auth = new Methods\Auth; |
|
| 651 | ||
| 652 | return $auth->getAccessToken($queryString); |
|
| 653 | } |
|
| 654 | ||
| 655 | /** |
|
| 656 | * Get the authenticated user |
|