| @@ 515-531 (lines=17) @@ | ||
| 512 | * @return string |
|
| 513 | * @throws TwitchException |
|
| 514 | */ |
|
| 515 | public function authLoginURL($scope) |
|
| 516 | { |
|
| 517 | if ($this->authConfig === false) { |
|
| 518 | $this->authConfigException(); |
|
| 519 | } |
|
| 520 | ||
| 521 | $queryString = $this->helper->buildQueryString(array( |
|
| 522 | 'response_type' => 'code', |
|
| 523 | 'client_id' => $this->authConfig['client_id'], |
|
| 524 | 'redirect_uri' => $this->authConfig['redirect_uri'], |
|
| 525 | 'scope' => $scope, |
|
| 526 | )); |
|
| 527 | ||
| 528 | $auth = new Methods\Auth; |
|
| 529 | ||
| 530 | return $auth->getLoginURL($queryString); |
|
| 531 | } |
|
| 532 | ||
| 533 | /** |
|
| 534 | * Get authentication access token |
|
| @@ 539-556 (lines=18) @@ | ||
| 536 | * @return \stdClass |
|
| 537 | * @throws TwitchException |
|
| 538 | */ |
|
| 539 | public function authAccessTokenGet($code) |
|
| 540 | { |
|
| 541 | if ($this->authConfig === false) { |
|
| 542 | $this->authConfigException(); |
|
| 543 | } |
|
| 544 | ||
| 545 | $queryString = $this->helper->buildQueryString(array( |
|
| 546 | 'client_id' => $this->authConfig['client_id'], |
|
| 547 | 'client_secret' => $this->authConfig['client_secret'], |
|
| 548 | 'grant_type' => 'authorization_code', |
|
| 549 | 'redirect_uri' => $this->authConfig['redirect_uri'], |
|
| 550 | 'code' => $code, |
|
| 551 | )); |
|
| 552 | ||
| 553 | $auth = new Methods\Auth; |
|
| 554 | ||
| 555 | return $auth->getAccessToken($queryString); |
|
| 556 | } |
|
| 557 | ||
| 558 | /** |
|
| 559 | * Get the authenticated user |
|