I have been trying to implement a FitBit API integration into my Laravel App for a couple of days now and getting nowhere. The only way I have managed to even get half way there is using Socialite Providers FitBit
The code I have used so far to retrieve the FitBit user profile works fine however this is useless because there is no documentation of what to do from there to get the users steps and other API data.
Routes File
Route::get('auth/fitbit', 'Auth\AuthController@newFitBit');
Route::get('auth/fitbit/callback', 'Auth\AuthController@storeFitBit');
AuthController
protected function newFitBit()
{
return Socialite::driver('fitbit')->redirect();
}
protected function storeFitBit()
{
$user = Socialite::driver('fitbit')->user();
dd($user);
}
The first function presents the FitBit permission screen as it should. When the user clicks allow to grant the app permission it redirects to the second function which currently dumps out the user object.
What I really want to know is how to use the user object to access FitBit API data for that user as there is no documentation I was wondering if anyone else has come across this issue and had a solution.
User Object Dump
User {#201 ▼
+token: "eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NDM3ODE2NzksInNjb3BlcyI6Indwcm8gd251dCB3c2xlIHdzZXQgd3dlaSB3YWN0IHdzb2MiLCJzdWIiOiIzTVhUS1IiLCJhdWQiOiIyMjlWWjYiLCJpc3MiOiJGaXRiaXQiLCJ0eXAiOiJhY2Nlc3NfdG9rZW4iLCJpYXQiOjE0NDM3NzgwNzl9.orn5UkgmtTJ9Xfjr8G8pp6YYSIit8XJEsVmA7KXJ56U"
+id: "3MXTKR"
+nickname: "Mark"
+name: "Mark Blythe"
+email: null
+avatar: "https://d6y8zfzc2qfsl.cloudfront.net/50ECA47F-8FCE-1607-B66E-D0D317A40F4A_profile_150_square.jpg"
+"user": array:1 [▶]
}
Any help would be greatly appreciated.