- How do I install the Fitbit provider for Laravel Socialite?
- Install it with Composer by running composer require socialiteproviders/fitbit. Laravel Socialite and the socialiteproviders/manager package should already be available in the application so the provider can be resolved. After installation, add your Fitbit credentials to config/services.php and use the fitbit driver like any other Socialite driver.
- Where do I put my Fitbit client ID and secret in Laravel?
- Add a fitbit entry to config/services.php with client_id, client_secret, and redirect values taken from your Fitbit application settings. Keep the real values in your .env file and reference them with env() calls so secrets never land in version control. Remember to clear or re-cache config after changing those values.
- How do I register the Fitbit Socialite driver in Laravel?
- The provider is resolved through the SocialiteProviders manager, which listens for the SocialiteWasCalled event. On current manager versions this listener is registered automatically; on older setups you add it to your EventServiceProvider. Once registered, call Socialite::driver('fitbit') wherever you need it.
- Which Laravel and Socialite versions does socialiteproviders/fitbit support?
- Because the package is a subtree split of the SocialiteProviders/Fitbit provider, its requirements track the parent SocialiteProviders/Providers repository. Check the composer.json of the version you install for the exact illuminate/support and socialite constraints. Review those constraints before upgrading Laravel or Socialite in an existing app.
- How do I set up the Fitbit OAuth redirect and callback routes?
- Create a redirect route that calls Socialite::driver('fitbit')->redirect() and a callback route that calls ->user() on the same driver. The callback URL registered in your Fitbit app must match the redirect value in config/services.php exactly, including scheme and trailing slash. Keep both routes as GET requests and outside auth middleware so unauthenticated users can start the flow.
- What user data does the Fitbit provider return after login?
- After the callback you get a standard Socialite user object populated with the Fitbit account details the provider maps, such as the Fitbit user ID and profile fields. That object also carries the access token you need for further Fitbit API calls. Store the token against your user record if you plan to fetch data later.
- Can I read Fitbit activity, sleep, and heart-rate data with this package?
- This package handles the OAuth handshake and profile retrieval, not the Fitbit health endpoints themselves. After authentication, take the token from the Socialite user and call Fitbit's Web API for steps, sleep logs, and heart-rate time series. Most apps add a thin HTTP client or a dedicated Fitbit API wrapper for that part.
- What are the alternatives to socialiteproviders/fitbit for Fitbit OAuth in Laravel?
- You can require the SocialiteProviders/Providers monorepo directly, or use league/oauth2-client with a community Fitbit provider. Staying on Laravel Socialite plus this driver is usually the least effort if Socialite already powers your other logins. Hand-rolling the Fitbit OAuth flow is possible but leaves state handling, token refresh, and error handling to you.
- How do I test Fitbit login in Laravel without calling the real Fitbit API?
- Mock the driver with Socialite::shouldReceive('driver')->with('fitbit') and return a fake user object, or use Socialite::fake() if your Socialite version supports it. That lets you exercise your callback controller and user creation logic without network calls. Cover the failure path too, such as a denied consent screen or an invalid state parameter.
- Is socialiteproviders/fitbit maintained and safe to use in production?
- It is a read-only split of the SocialiteProviders/Fitbit provider, so fixes land in the SocialiteProviders/Providers monorepo and are published here on the same release cadence. Pin a specific version in composer.json and read the monorepo changelog before upgrading. In production, store tokens securely, handle token expiry and refresh, and watch Fitbit's API rate limits.