I'm facing difficulty in fetching URL parameters from redirect URL of Fitbit I'm here trying to integrate Fitbit without using socialite or any other package.
I have the following URL:
http://localhost/abc/public/portal/fitbit/fitbitIntegration#access_token=eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI1WjVLUzUiLCJhdWQiOiIyMjhMNjUiLCJpc3MiOiJGaXRiaXQiLCJ0eXAiOiJhY2Nlc3NfdG9rZW4iLCJzY29wZXMiOiJ3aHIgd251dCB3cHJvIHdzbGUgd3dlaSB3c29jIHdzZXQgd2FjdCB3bG9jIiwiZXhwIjoxNTA1NDU5MTM2LCJpYXQiOjE1MDQ4NzE1MjF9.iQ9nxbzmvar2DlG_848b3MTefq7q0wxyXByTb1Bb2o4&user_id=5Z5KS5&scope=sleep+settings+nutrition+activity+social+heartrate+profile+weight+location&token_type=Bearer&expires_in=587615
All I want to fetch all the information after the #
like I want to get user_id
here
I have tried this to accomplish
public function fitbitIntegration(Request $request)
{
try{
$authId = Auth::user()->id;
$fitbit = new FitbitMaster();
$fitbit->user_id = $authId;
$fitbit->fitbit_client_id = $request->user_id;
$fitbit->save();
flash('Connected', 'success');
return redirect()->back();
}
catch (QueryException $exception)
{
echo $exception->getMessage();
}
}
Route
Route::get('fitbitIntegration', 'BackEnd\fitbit@fitbitIntegration');
But I'm not getting the user_id
here which got me Integrity constraint error
How to get user_id
here in my case?