I am working on the api part in Laravel 5.2 and am trying to get details from Strava. As mentioned in this link http://socialiteproviders.imtqy.com/providers/strava I took all the steps. In the controller, I wrote a function to transfer the user's access token. This is the function that I am using the public function
<?php
namespace App\Http\Controllers\Api\v1;
use Illuminate\Http\Request;
use Auth;
use Socialite;
use App\Models\UserTrackerSettings;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class StravaController extends Controller
{
public function getTrackerAccess()
{
$trackerDriver = Socialite::driver('strava');
$getToken = UserTrackerSettings::where('tracker_source_name', 'strava')
->where('user_id', Auth::user()->id)->first();
$access_token = $getToken->access_token;
return Socialite::getUserByToken($access_token);
}
}
But when I run the link in the postman, I get this error
FatalErrorException in line StravaController.php 23: Calling the undefined method SocialiteProviders \ Manager \ ServiceProvider :: driver ()
It would be great if someone could help me. Thanks in advance!
source
share