2

I'm trying to get a Social login with Facebook in place using Laravel and The league OAuth2 client but I'm getting this error:

Required option not passed: access_token Array ( [{"error":{"message":"Error_validating_client_secret_","type":"OAuthException","code":1}}] => )

I've followed the instructionns in the package github page, but I can't get it to work.

My controller action code:

 $facebook = $this->socialRepository->facebookLogin();
    $code = \Input::get("code");

    if(!isset($code)) {
        $authURL = $facebook->getAuthorizationUrl();
        return \Redirect::away($authURL);
    } else {
        $token = $facebook->getAccessToken('authorization_code', ['code' => $code]);
        try {
            $userDetails = $facebook->getUserDetails($token);
            dd($userDetails);
        } catch (\Exception $e) {}
    }

And the repository code:

public function facebookLogin()
{
    return new Facebook(
        [
            'clientId'      => $this->config->get("social.facebook.clientID"),
            'clientSecret'  => $this->config->get("social.facebook.clientSercret"),
            'redirectUri'   => $this->config->get("social.facebook.redirectUri"),
            'scopes'        => $this->config->get("social.facebook.scopes"),
        ]
    );
}
Oliver W.
  • 13,169
  • 3
  • 37
  • 50
Imad Bloum
  • 23
  • 2

1 Answers1

1

This normally happens when the redirect URL, app ID or secret are incorrect. For example,

'clientSecret'  => $this->config->get("social.facebook.clientSercret"),

Are you you meant social.facebook.clientSercret and not social.facebook.clientSecret (no extra r)

phwd
  • 19,975
  • 5
  • 50
  • 78