Call the undefined method SocialiteProviders \ Manager \ ServiceProvider :: driver ()

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
{
    /**
    * Get the user by token
    *
    * @return \Illuminate\Http\Response
    */
    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!

+4
source share
1

, driver . , , : \App\Socialite::driver('strava') \Socialite::driver('strava'), , .

0

Source: https://habr.com/ru/post/1624424/


All Articles