{"record":{"id":"a722cd8013d27b07","repo":"krayin/laravel-crm","slug":"failed-to-refresh-google-access-token","errorCode":null,"errorMessage":"Failed to refresh Google access token: {}","messagePattern":"Failed to refresh Google access token: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"packages/Webkul/GoogleContact/src/Services/TokenRefresher.php","lineNumber":54,"sourceCode":"        return $client;\n    }\n\n    /**\n     * Refresh and persist a new access token.\n     *\n     * Google frequently omits `refresh_token` on refresh responses, so the\n     * previously stored refresh token is only replaced when a new one is given.\n     */\n    protected function refresh(Client $client, GoogleContactAccount $account): void\n    {\n        if (! $account->refresh_token) {\n            throw new RuntimeException('Google account has no refresh token; the user must reconnect their Google account.');\n        }\n\n        $token = $client->fetchAccessTokenWithRefreshToken($account->refresh_token);\n\n        if (isset($token['error'])) {\n            throw new RuntimeException('Failed to refresh Google access token: '.($token['error_description'] ?? $token['error']));\n        }\n\n        $this->googleContactAccountRepository->update([\n            'access_token' => $token['access_token'],\n            'refresh_token' => $token['refresh_token'] ?? $account->refresh_token,\n            'expires_at' => now()->addSeconds($token['expires_in'] ?? 3600),\n        ], $account->id);\n\n        $client->setAccessToken($token);\n    }\n}\n","sourceCodeStart":36,"sourceCodeEnd":66,"githubUrl":"https://github.com/krayin/laravel-crm/blob/13d6988cda8d69ece45ee1890effc90a7f21cdc1/packages/Webkul/GoogleContact/src/Services/TokenRefresher.php#L36-L66","documentation":"Error \"Failed to refresh Google access token: {}\" thrown in krayin/laravel-crm.","triggerScenarios":"Thrown at packages/Webkul/GoogleContact/src/Services/TokenRefresher.php:54 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"13d6988cda8d69ece45ee1890effc90a7f21cdc1","analyzedAt":"2026-08-17T00:58:29.000Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}