Missing redirect_uri paramater & invalid grant_type when using hybridauth

164 views Asked by At

I have set up some credentials in my google project and a staging app on facebook, using the correct credentials for each and using Hybridauth on my php app I keep getting a "missing redirect_uri parameter" error for facebook and an "invalid grant_type" error for google. Using a different set of credentials for google and facebook both work perfectly on my local set up. Its just when I swap the credentials and upload to staging server that i am getting this issue. Any help would be great thank you.

      class HybridAuth {    

    /**
     * @return
     */

    public function getUserProfile($platform = 'facebook', $withBooking = false) {
      $withBooking = ($withBooking) ? '&withBooking=true' : '';
      $config = [ 'callback' => config('app.url.fullyQualifiedDomain') . '/auth/social-login?platform=' . $platform . $withBooking,
                    'keys'  => ['id' => config('vendors.' . $platform . '.keys.appId'),
                                  'secret' => config('vendors.' . $platform . '.keys.appSecret')]];

      $hybridauth = $this->$platform($config);

      try {
        $hybridauth->authenticate();
        $isConnected = $hybridauth->isConnected();        
        if($isConnected){
          $userProfile = $hybridauth->getUserProfile();
          $hybridauth->disconnect();
          return $userProfile;
        }
        return false;
      } catch(\Exception $e) {
        trigger_error(get_class($e) . ': ' . $e->getMessage() . '<br /><br />' . $e->getTraceAsString(), E_USER_ERROR);
      }
    }


    private function facebook($config) {
      return new \Hybridauth\Provider\Facebook($config);
    }


    private function google($config) {
      return new \Hybridauth\Provider\Google($config);
    }
  }
0

There are 0 answers