src/Session.php
public function requestCredentialsToken()
    {
        $payload = base64_encode($this->getClientId() . ':' . $this->getClientSecret());

        $parameters = [
            'grant_type' => 'client_credentials',
        ];

        $headers = [
            'Authorization' => 'Basic ' . $payload,
        ];

        $response = $this->request->account('POST', '/api/token', $parameters, $headers);
        $response = $response['body'];

        if (isset($response->access_token)) {
            $this->accessToken = $response->access_token;
            $this->expirationTime = time() + $response->expires_in;
            $this->scope = isset($response->scope) ? $response->scope : $this->scope;

            return true;
        }

        return false;
    }
public function requestCredentialsToken()
    {
        $payload = base64_encode($this->getClientId() . ':' . $this->getClientSecret());

        $parameters = [
            'grant_type' => 'client_credentials',
        ];

        $headers = [
            'Authorization' => 'Basic ' . $payload,
        ];

        $response = $this->request->account('POST', '/api/token', $parameters, $headers);
        $response = $response['body'];

        if (isset($response->access_token)) {
            $this->accessToken = $response->access_token;
            $this->expirationTime = time() + $response->expires_in;
            $this->scope = isset($response->scope) ? $response->scope : $this->scope;

            return true;
        }

        return false;
    }
public function requestCredentialsToken ( ) { $ payload = base64_encode ( $ this -> getClientId ( ) . ':' . $ this -> getClientSecret ( ) ) ; $ parameters = [ 'grant_type' => 'client_credentials' , ] ; $ headers = [ 'Authorization' => 'Basic ' . $ payload , ] ; $ response = $ this -> request -> account ( 'POST' , '/api/token' , $ parameters , $ headers ) ; $ response = $ response [ 'body' ] ; if ( isset ( $ response -> access_token ) ) { $ this -> accessToken = $ response -> access_token ; $ this -> expirationTime = time ( ) + $ response -> expires_in ; $ this -> scope = isset ( $ response -> scope ) ? $ response -> scope : $ this -> scope ; return true ; } return false ; }
Request an access token using the Client Credentials Flow.

@return bool True when an access token was successfully granted, false otherwise.
Request an access token using the Client Credentials Flow .