public function getToken($refresh = false)
    {
        if ($refresh || empty($this->_token)) {
            $data = ['grant_type' => 'client_credentials'];
            $this->_token = $this->_request(self::URN_ISSUE, $data);

            // check for valid response
            if (empty($this->_token->access_token)) {
                throw new AuthException('Unexpected empty token from the authentication server');
            }
        }
        return $this->_token;
    }
public function getToken($refresh = false)
    {
        if ($refresh || empty($this->_token)) {
            $data = ['grant_type' => 'client_credentials'];
            $this->_token = $this->_request(self::URN_ISSUE, $data);

            // check for valid response
            if (empty($this->_token->access_token)) {
                throw new AuthException('Unexpected empty token from the authentication server');
            }
        }
        return $this->_token;
    }
public function getToken ( $ refresh = false ) { if ( $ refresh || empty ( $ this -> _token ) ) { $ data = [ 'grant_type' => 'client_credentials' ] ; $ this -> _token = $ this -> _request ( self :: URN_ISSUE , $ data ) ; // check for valid response if ( empty ( $ this -> _token -> access_token ) ) { throw new AuthException ( 'Unexpected empty token from the authentication server' ) ; } } return $ this -> _token ; }
Get an auth token for these client credentials

@param bool $refresh whether to force fetching a new token
@return \StdClass the auth token object
Get an auth token for these client credentials