lib/Imgur/Auth/OAuth2.php
public function refreshToken()
    {
        $token = $this->getAccessToken();

        try {
            $response = $this->httpClient->post(
                self::ACCESS_TOKEN_ENDPOINT,
                [
                    'refresh_token' => $token['refresh_token'],
                    'client_id' => $this->clientId,
                    'client_secret' => $this->clientSecret,
                    'grant_type' => 'refresh_token',
                ]
            );

            $responseBody = json_decode($response->getBody(), true);
        } catch (\Exception $e) {
            throw new AuthException('Request for refresh access token failed: ' . $e->getMessage(), $e->getCode());
        }

        $this->setAccessToken($responseBody);

        $this->sign();

        return $responseBody;
    }
public function refreshToken()
    {
        $token = $this->getAccessToken();

        try {
            $response = $this->httpClient->post(
                self::ACCESS_TOKEN_ENDPOINT,
                [
                    'refresh_token' => $token['refresh_token'],
                    'client_id' => $this->clientId,
                    'client_secret' => $this->clientSecret,
                    'grant_type' => 'refresh_token',
                ]
            );

            $responseBody = json_decode($response->getBody(), true);
        } catch (\Exception $e) {
            throw new AuthException('Request for refresh access token failed: ' . $e->getMessage(), $e->getCode());
        }

        $this->setAccessToken($responseBody);

        $this->sign();

        return $responseBody;
    }
public function refreshToken ( ) { $ token = $ this -> getAccessToken ( ) ; try { $ response = $ this -> httpClient -> post ( self :: ACCESS_TOKEN_ENDPOINT , [ 'refresh_token' => $ token [ 'refresh_token' ] , 'client_id' => $ this -> clientId , 'client_secret' => $ this -> clientSecret , 'grant_type' => 'refresh_token' , ] ) ; $ responseBody = json_decode ( $ response -> getBody ( ) , true ) ; } catch ( \ Exception $ e ) { throw new AuthException ( 'Request for refresh access token failed: ' . $ e -> getMessage ( ) , $ e -> getCode ( ) ) ; } $ this -> setAccessToken ( $ responseBody ) ; $ this -> sign ( ) ; return $ responseBody ; }
If a user has authorized their account but you no longer have a valid access_token for them,
then a new one can be generated by using the refresh_token.
When your application receives a refresh token, it is important to store that refresh token for future use.
If your application loses the refresh token,
you will have to prompt the user for their login information again.

@throws AuthException

@return array
If a user has authorized their account but you no longer have a valid access_token for them then a new one can be generated by using the refresh_token . When your application receives a refresh token it is important to store that refresh token for future use . If your application loses the refresh token you will have to prompt the user for their login information again .