scopes([ 'https://www.googleapis.com/auth/gmail.readonly', 'https://www.googleapis.com/auth/gmail.send', ]) ->with([ 'access_type' => 'offline', 'prompt' => 'consent select_account', ]); return $driver->redirect(); } public static function getConnectedEmail(): ?string { if (!class_exists(GmailClient::class)) { return null; } try { $data = json_decode(File::get(GmailClient::tokenPath()), true); return $data['email'] ?? null; } catch (FileNotFoundException $e) { return null; } } }