I can't seem to understand right now as to why i'm receiving this error. All of my social logins bar google seems to work and i can retrieve the array of data needed from the google api. Whenever i Auth::user($user) and Auth::check this it returns true and users are logged in as well as data is being stored within my database. However i can't seem to understand as to why i might be recieving this error. I'm using the oriceon/oauth-5-laravel packaage to login to google. The code is as follows.
The AuthenticateUser class
if ($provider == "google") {
$code = Input::get('code');
// get google service
$googleService = \OAuth::consumer('Google');
// check if code is valid
// if code is provided get user data and sign in
if ( ! is_null($code))
{
// This was a callback request from google, get the token
$token = $googleService->requestAccessToken($code);
// Send a request with it
$result = json_decode($googleService->request('https://www.googleapis.com/oauth2/v1/userinfo'), true);
//Var_dump
//display whole array.
$user = $this->users->findByUserNameOrCreate($result, $provider);
$this->auth->login($user, true);
return $listener->userHasLoggedIn($user, $provider);
}
else
{
// get googleService authorization
$url = $googleService->getAuthorizationUri();
// return to google login url
return redirect((string)$url);
}
}
The userHasLoggedIn function
public function userHasLoggedIn($user, $provider) {
\Session::flash('message', 'Welcome, ' . $user->username);
if ($provider === 'facebook'){
$likes = json_decode($user->likes);
return redirect('/dashboard');
}
return redirect('/dashboard');
}
I have 4 other social logins as well as a standard registration form which all the logins work fine on. Instagram and LinkedIn share basically the same code in the autenticate user class and login perfectly as well as updateing my datatabase.
As i've never encountered this issue before, i don't know what additional code to include to help solve to issue. The error code is:
MethodNotAllowedHttpException in RouteCollection.php line 219: in RouteCollection.php line 219 at RouteCollection->methodNotAllowed(array('GET', 'HEAD')) in RouteCollection.php line 206
Any help or guidance would be much appreciated.
Thanks