- Does this package support Laravel 10.x or only older versions?
- The package was last updated in 2021 and lacks explicit Laravel 10.x support. While it may work with Laravel 7.x–9.x, test thoroughly for compatibility, especially with updated dependencies like `spatie`. Check the `composer.json` constraints for Laravel version requirements.
- How do I configure multiple Google API services (e.g., YouTube + GMB) with different credentials?
- Use service-specific overrides in `.env` (e.g., `YOUTUBE_CLIENT_ID`, `GMB_CLIENT_SECRET`) or publish the config and customize `config/google-api.php`. The package defaults to global credentials but allows per-service overrides without manual OAuth setup for each.
- Can I use this package with Google API v3.x or only v2.x?
- The package relies on `google/apiclient` v2.x, which may not fully support Google API v3.x features. If you need v3.x, consider alternatives like `spatie/google-api` or manually integrate the latest SDK. Test thoroughly if you must use v2.x.
- How do I store and retrieve access tokens securely?
- Tokens are stored in the `keys` table via the `Key` model, referenced by a configurable slug (set via `GOOGLE_ACCESS_TOKEN_SLUG`). Ensure the `value` field contains valid JSON-formatted tokens. Use Laravel’s encryption or database encryption for sensitive data.
- Does this package work with Laravel Nova for managing Google API credentials?
- Yes, the package includes Nova resources for the `GMB Account` and `Key` models. Publish the config, register Nova, and access these resources in Nova’s UI. Policies from `tipoff/authorization` are pre-registered, so no manual setup is needed.
- What happens if my Google OAuth token expires? How do I refresh it?
- The package doesn’t include built-in token refresh logic. You’ll need to manually refresh tokens via Google’s OAuth flow or use a library like `league/oauth2-client`. Store the refreshed token in the `keys` table and update the slug in `.env`.
- Are there alternatives to this package with better maintenance?
- Yes, consider `spatie/google-api` (more actively maintained) or `google/apiclient` directly for full control. If you need Laravel-specific features, evaluate `spatie`’s package for OAuth and token management, which may align better with modern Laravel practices.
- How do I handle rate limits or exponential backoff for Google API calls?
- The package doesn’t include built-in rate-limiting logic. Use Laravel’s HTTP client middleware (e.g., Guzzle’s `RetryMiddleware`) or Google’s client library methods to handle retries. Monitor API responses for rate-limit errors (`429`) and implement custom logic as needed.
- Can I customize the OAuth redirect URIs or JavaScript origins dynamically?
- Yes, use the `|` separator in `.env` for `GOOGLE_REDIRECT_URIS` and `GOOGLE_JAVASCRIPT_ORIGINS` to support multiple values. For dynamic values, override the config or use Laravel’s binding system to inject runtime values into the OAuth client.
- Does this package support service accounts (non-OAuth) for Google APIs?
- No, the package is designed for OAuth-based authentication only. For service accounts, use the `google/apiclient` library directly or extend this package’s `GoogleApiServiceProvider` to support service account credentials via `GOOGLE_SERVICE_ACCOUNT_JSON`.