src/DivideIQ.php
protected function authenticate($refresh = false)
    {
        $token = $refresh ? $this->refreshToken : $this->authToken ;

        $response = $this->client->get('authenticate', [
            'headers' => ['Authentication' => $token->getToken()],
        ]);

        // Parse the response body.
        $json = json_decode($response->getBody());
        $body = $json->{'nl.divide.iq'};
        $expire = new \DateTime($body->expiration_date, new \DateTimezone('UTC'));

        // Store the access and refresh (if any) tokens in the object.
        $this->accessToken = new Token($body->access_token, $expire);
        if (isset($body->refresh_token)) {
            $this->refreshToken = new Token($body->refresh_token);
        }

        return $this;
    }
protected function authenticate($refresh = false)
    {
        $token = $refresh ? $this->refreshToken : $this->authToken ;

        $response = $this->client->get('authenticate', [
            'headers' => ['Authentication' => $token->getToken()],
        ]);

        // Parse the response body.
        $json = json_decode($response->getBody());
        $body = $json->{'nl.divide.iq'};
        $expire = new \DateTime($body->expiration_date, new \DateTimezone('UTC'));

        // Store the access and refresh (if any) tokens in the object.
        $this->accessToken = new Token($body->access_token, $expire);
        if (isset($body->refresh_token)) {
            $this->refreshToken = new Token($body->refresh_token);
        }

        return $this;
    }
protected function authenticate ( $ refresh = false ) { $ token = $ refresh ? $ this -> refreshToken : $ this -> authToken ; $ response = $ this -> client -> get ( 'authenticate' , [ 'headers' => [ 'Authentication' => $ token -> getToken ( ) ] , ] ) ; // Parse the response body. $ json = json_decode ( $ response -> getBody ( ) ) ; $ body = $ json -> { 'nl.divide.iq' } ; $ expire = new \ DateTime ( $ body -> expiration_date , new \ DateTimezone ( 'UTC' ) ) ; // Store the access and refresh (if any) tokens in the object. $ this -> accessToken = new Token ( $ body -> access_token , $ expire ) ; if ( isset ( $ body -> refresh_token ) ) { $ this -> refreshToken = new Token ( $ body -> refresh_token ) ; } return $ this ; }
Authenticates using the stored authentication token.

@param bool $refresh
Whether to use the refresh token instead of the authentication token.
Authenticates using the stored authentication token .