Giter Club home page Giter Club logo

Comments (6)

abdulquddus avatar abdulquddus commented on September 16, 2024

I am facing same issue Kartik please can you help on this.

from yii2-social.

kartik-v avatar kartik-v commented on September 16, 2024

You have not mentioned where and how you received the error.

The error mentions that you failed to pass a facebook session identifier.

If you are using facebook api, check the documentation on how to use the facebook api

from yii2-social.

abdulquddus avatar abdulquddus commented on September 16, 2024

Sorry I know question is closed but when I use this code.
$social = Yii::$app->getModule('social');
// Render the Login button
$url = Yii::$app->request->getAbsoluteUrl(); // or any absolute url you want to redirect
helper = $social->getFbLoginHelper($url);
$loginUrl = $helper->getLoginUrl();
echo Html::a('Facebook Login', $loginUrl, ['class'=>'btn btn-primary']);

// in your other action that processes the login
// use the output from the helper
$helper = $social->getFbLoginHelper($url); // the same url
$session = $social->getFbSession(['source'=>$helper]); // do anything with this session now

// for example get the graph user object for current user
$user = $social->getFbGraphUser($session);
echo 'User is ' . $user->getName();

the error goes when I comment out the last two lines

//$user = $social->getFbGraphUser($session);
//echo 'User is ' . $user->getName();

and button appears. If these lines are removed than how a session is created. thanks in advance.

from yii2-social.

kartik-v avatar kartik-v commented on September 16, 2024

An example set of codes are provided. But you need to use them carefully. NOTE: not all code in the example is to be written altogether in the same view.

You need to read through the comments.

The button is created via Html::a

Subequently you need to write the rest of the code in the loginUrl controller action as mentioned in the comment

// in your other action that processes the login
// use the output from the helper

from yii2-social.

abdulquddus avatar abdulquddus commented on September 16, 2024

Thanks Karthik that was very helping.

from yii2-social.

morhaf-ko avatar morhaf-ko commented on September 16, 2024

Please Karthik I need your help i'm facing this error:
Argument 1 passed to Facebook\Helpers\FacebookRedirectLoginHelper::__construct() must be an instance of Facebook\Authentication\OAuth2Client, string given, called in /home/itenginn/public_html/let/vendor/kartik-v/yii2-social/Module.php on line 207 and defined

This my view:

title = 'Facebook'; ?>

tools/facebook


Please login to facebook to start using this tool: getModule('social'); $url = Yii::$app->request->getAbsoluteUrl(); // or any absolute url you want to redirect $helper = $social->getFbLoginHelper($url); $loginUrl = $helper->getLoginUrl(); echo Html::a('Facebook Login', $loginUrl, ['class'=>'btn btn-primary']); ?>
</br>       
</div>

from yii2-social.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.