| @@ 530-546 (lines=17) @@ | ||
| 527 | * @return string |
|
| 528 | * @throws TwitchException |
|
| 529 | */ |
|
| 530 | public function authLoginURL($scope) |
|
| 531 | { |
|
| 532 | if ($this->authConfig === false) { |
|
| 533 | $this->authConfigException(); |
|
| 534 | } |
|
| 535 | ||
| 536 | $queryString = $this->helper->buildQueryString(array( |
|
| 537 | 'response_type' => 'code', |
|
| 538 | 'client_id' => $this->authConfig['client_id'], |
|
| 539 | 'redirect_uri' => $this->authConfig['redirect_uri'], |
|
| 540 | 'scope' => $scope, |
|
| 541 | )); |
|
| 542 | ||
| 543 | $auth = new Methods\Auth; |
|
| 544 | ||
| 545 | return $auth->getLoginURL($queryString); |
|
| 546 | } |
|
| 547 | ||
| 548 | /** |
|
| 549 | * Get authentication access token |
|
| @@ 554-571 (lines=18) @@ | ||
| 551 | * @return \stdClass |
|
| 552 | * @throws TwitchException |
|
| 553 | */ |
|
| 554 | public function authAccessTokenGet($code) |
|
| 555 | { |
|
| 556 | if ($this->authConfig === false) { |
|
| 557 | $this->authConfigException(); |
|
| 558 | } |
|
| 559 | ||
| 560 | $queryString = $this->helper->buildQueryString(array( |
|
| 561 | 'client_id' => $this->authConfig['client_id'], |
|
| 562 | 'client_secret' => $this->authConfig['client_secret'], |
|
| 563 | 'grant_type' => 'authorization_code', |
|
| 564 | 'redirect_uri' => $this->authConfig['redirect_uri'], |
|
| 565 | 'code' => $code, |
|
| 566 | )); |
|
| 567 | ||
| 568 | $auth = new Methods\Auth; |
|
| 569 | ||
| 570 | return $auth->getAccessToken($queryString); |
|
| 571 | } |
|
| 572 | ||
| 573 | /** |
|
| 574 | * Get the authenticated user |
|