Jump to content
  • 0

Error 500 TM Social Login, Facebook login


SunFires

Question

Witam

 

Mam problem z konfiguracją TM social login, google poszło ładnie gładko a z facebookiem jest problem wywala error 500, niby robiłem wszystko zgodnie z toturialem ale coś jest nie tak.
W trybie debugowania wywala:

Fatal error: Cannot use object of type stdClass as array in /home/users/sunfires/public_html/modules/tmsociallogin/facebook/FacebookRedirectLoginHelper.php on line 186

 

I teraz nie wiem czy źle jest skonfigurowana apka na fb czy raczej grzebać w kodzie modułu.

public function getSessionFromRedirect()
  {
    $this->loadState();
    if ($this->isValidRedirect()) {
      $params = array(
        'client_id' => FacebookSession::_getTargetAppId($this->appId),
        'redirect_uri' => $this->redirectUrl,
        'client_secret' =>
          FacebookSession::_getTargetAppSecret($this->appSecret),
        'code' => $this->getCode()
      );
      $response = (new FacebookRequest(
        FacebookSession::newAppSession($this->appId, $this->appSecret),
        'GET',
        '/oauth/access_token',
        $params
      ))->execute()->getResponse();
      if (isset($response['access_token'])) {
        return new FacebookSession($response['access_token']);
      }
    }
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

modules/tmsociallogin/facebook/FacebookRedirectLoginHelper.php

 

replace

  /**
   * Handles a response from Facebook, including a CSRF check, and returns a
   *   FacebookSession.
   *
   * @return FacebookSession|null
   */
  public function getSessionFromRedirect()
  {
    $this->loadState();
    if ($this->isValidRedirect()) {
      $params = array(
        'client_id' => FacebookSession::_getTargetAppId($this->appId),
        'redirect_uri' => $this->redirectUrl,
        'client_secret' =>
          FacebookSession::_getTargetAppSecret($this->appSecret),
        'code' => $this->getCode()
      );
      $response = (new FacebookRequest(
        FacebookSession::newAppSession($this->appId, $this->appSecret),
        'GET',
        '/oauth/access_token',
        $params
      ))->execute()->getResponse();
      if (isset($response->access_token)) {
        return new FacebookSession($response->access_token);
      }
    }
    return null;
  }
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...