| @@ 492-508 (lines=17) @@ | ||
| 489 | * @return string |
|
| 490 | * @throws TwitchException |
|
| 491 | */ |
|
| 492 | public function authLoginURL($scope) |
|
| 493 | { |
|
| 494 | if ($this->authConfig === false) { |
|
| 495 | $this->authConfigException(); |
|
| 496 | } |
|
| 497 | ||
| 498 | $queryString = $this->helper->buildQueryString(array( |
|
| 499 | 'response_type' => 'code', |
|
| 500 | 'client_id' => $this->authConfig['client_id'], |
|
| 501 | 'redirect_uri' => $this->authConfig['redirect_uri'], |
|
| 502 | 'scope' => $scope, |
|
| 503 | )); |
|
| 504 | ||
| 505 | $auth = new Methods\Auth; |
|
| 506 | ||
| 507 | return $auth->getLoginURL($queryString); |
|
| 508 | } |
|
| 509 | ||
| 510 | /** |
|
| 511 | * Get authentication access token |
|
| @@ 516-533 (lines=18) @@ | ||
| 513 | * @return \stdClass |
|
| 514 | * @throws TwitchException |
|
| 515 | */ |
|
| 516 | public function authAccessTokenGet($code) |
|
| 517 | { |
|
| 518 | if ($this->authConfig === false) { |
|
| 519 | $this->authConfigException(); |
|
| 520 | } |
|
| 521 | ||
| 522 | $queryString = $this->helper->buildQueryString(array( |
|
| 523 | 'client_id' => $this->authConfig['client_id'], |
|
| 524 | 'client_secret' => $this->authConfig['client_secret'], |
|
| 525 | 'grant_type' => 'authorization_code', |
|
| 526 | 'redirect_uri' => $this->authConfig['redirect_uri'], |
|
| 527 | 'code' => $code, |
|
| 528 | )); |
|
| 529 | ||
| 530 | $auth = new Methods\Auth; |
|
| 531 | ||
| 532 | return $auth->getAccessToken($queryString); |
|
| 533 | } |
|
| 534 | ||
| 535 | /** |
|
| 536 | * Get the authenticated user |
|