krayin/laravel-crm · error · RuntimeException

Google account has no refresh token; the user must reconnect

Error message

Google account has no refresh token; the user must reconnect their Google account.

What it means

Error "Google account has no refresh token; the user must reconnect their Google account." thrown in krayin/laravel-crm.

Source

Thrown at packages/Webkul/GoogleContact/src/Services/TokenRefresher.php:48

        ]);

        if ($client->isAccessTokenExpired()) {
            $this->refresh($client, $account);
        }

        return $client;
    }

    /**
     * Refresh and persist a new access token.
     *
     * Google frequently omits `refresh_token` on refresh responses, so the
     * previously stored refresh token is only replaced when a new one is given.
     */
    protected function refresh(Client $client, GoogleContactAccount $account): void
    {
        if (! $account->refresh_token) {
            throw new RuntimeException('Google account has no refresh token; the user must reconnect their Google account.');
        }

        $token = $client->fetchAccessTokenWithRefreshToken($account->refresh_token);

        if (isset($token['error'])) {
            throw new RuntimeException('Failed to refresh Google access token: '.($token['error_description'] ?? $token['error']));
        }

        $this->googleContactAccountRepository->update([
            'access_token' => $token['access_token'],
            'refresh_token' => $token['refresh_token'] ?? $account->refresh_token,
            'expires_at' => now()->addSeconds($token['expires_in'] ?? 3600),
        ], $account->id);

        $client->setAccessToken($token);
    }
}

View on GitHub (pinned to 13d6988cda)

When it happens

Trigger: Thrown at packages/Webkul/GoogleContact/src/Services/TokenRefresher.php:48 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of krayin/laravel-crm@13d6988cda (2026-08-17). Data as JSON: /api/errors/b9bccd79f8ebd490. Report an issue: GitHub.