src/Client.php
public function renewAccessToken($clientSecret)
    {
        if (null === $this->_state->token->data->refresh_token) {
            throw new \Exception(
                'The refresh token is not set or no permission for'
                    . ' \'wl.offline_access\' was given to renew the token'
            );
        }

        $values = [
            'client_id'     => $this->clientId,
            'client_secret' => $clientSecret,
            'grant_type'    => 'refresh_token',
            'refresh_token' => $this->_state->token->data->refresh_token,
        ];

        $response = $this->httpClient->post(
            self::TOKEN_URL,
            ['form_params' => $values]
        );

        $body = $response->getBody();
        $data = json_decode($body);

        if ($data === null) {
            throw new \Exception('json_decode() failed');
        }

        $this->_state->token = (object) [
            'obtained' => time(),
            'data'     => $data,
        ];
    }
public function renewAccessToken($clientSecret)
    {
        if (null === $this->_state->token->data->refresh_token) {
            throw new \Exception(
                'The refresh token is not set or no permission for'
                    . ' \'wl.offline_access\' was given to renew the token'
            );
        }

        $values = [
            'client_id'     => $this->clientId,
            'client_secret' => $clientSecret,
            'grant_type'    => 'refresh_token',
            'refresh_token' => $this->_state->token->data->refresh_token,
        ];

        $response = $this->httpClient->post(
            self::TOKEN_URL,
            ['form_params' => $values]
        );

        $body = $response->getBody();
        $data = json_decode($body);

        if ($data === null) {
            throw new \Exception('json_decode() failed');
        }

        $this->_state->token = (object) [
            'obtained' => time(),
            'data'     => $data,
        ];
    }
public function renewAccessToken ( $ clientSecret ) { if ( null === $ this -> _state -> token -> data -> refresh_token ) { throw new \ Exception ( 'The refresh token is not set or no permission for' . ' \'wl.offline_access\' was given to renew the token' ) ; } $ values = [ 'client_id' => $ this -> clientId , 'client_secret' => $ clientSecret , 'grant_type' => 'refresh_token' , 'refresh_token' => $ this -> _state -> token -> data -> refresh_token , ] ; $ response = $ this -> httpClient -> post ( self :: TOKEN_URL , [ 'form_params' => $ values ] ) ; $ body = $ response -> getBody ( ) ; $ data = json_decode ( $ body ) ; if ( $ data === null ) { throw new \ Exception ( 'json_decode() failed' ) ; } $ this -> _state -> token = ( object ) [ 'obtained' => time ( ) , 'data' => $ data , ] ; }
Renews the access token from OAuth. This token is valid for one hour.

@param string $clientSecret
The client secret.
Renews the access token from OAuth . This token is valid for one hour .