public function getToken($authorization_code = null) {

		if ($authorization_code == null) {
			$authorization_code = $this->getAuthorizationCode();
		}

		$params = $_SESSION[$this->oauth_key];
		unset($_SESSION[$this->oauth_key]);

		$response = $this->client->post('oauth/token', [
			'client_id'		=> $this->client->id(),
			'grant_type'	=> 'authorization_code',
			'code'			=> $authorization_code,
			'scope'			=> $params['scope'],
			'redirect_uri'	=> $params['redirect_uri'],
		]);
		return $response->data('token');
	}
public function getToken($authorization_code = null) {

		if ($authorization_code == null) {
			$authorization_code = $this->getAuthorizationCode();
		}

		$params = $_SESSION[$this->oauth_key];
		unset($_SESSION[$this->oauth_key]);

		$response = $this->client->post('oauth/token', [
			'client_id'		=> $this->client->id(),
			'grant_type'	=> 'authorization_code',
			'code'			=> $authorization_code,
			'scope'			=> $params['scope'],
			'redirect_uri'	=> $params['redirect_uri'],
		]);
		return $response->data('token');
	}
public function getToken ( $ authorization_code = null ) { if ( $ authorization_code == null ) { $ authorization_code = $ this -> getAuthorizationCode ( ) ; } $ params = $ _SESSION [ $ this -> oauth_key ] ; unset ( $ _SESSION [ $ this -> oauth_key ] ) ; $ response = $ this -> client -> post ( 'oauth/token' , [ 'client_id' => $ this -> client -> id ( ) , 'grant_type' => 'authorization_code' , 'code' => $ authorization_code , 'scope' => $ params [ 'scope' ] , 'redirect_uri' => $ params [ 'redirect_uri' ] , ] ) ; return $ response -> data ( 'token' ) ; }
Swap an authorization code for a token.

@param string $authorization_code (optional)
@return array
Swap an authorization code for a token .