首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用facebook-opengraph插件登录yii

如何使用facebook-opengraph插件登录yii
EN

Stack Overflow用户
提问于 2012-06-01 16:20:12
回答 1查看 2.3K关注 0票数 4

嗨,我正在尝试使用facebook图形api通过facebook登录。我使用下面的代码来显示登录

代码语言:javascript
复制
<?php $this->widget('ext.yii-facebook-opengraph.plugins.LoginButton', array(
'show_faces'=>true,
'registration_url'=>'http://mysite/index.php/users/facebookregister',
'oauth'=>true,  // JS SDK -enable OAuth 2.0
)); ?>

在重定向的页面中,我正在做

代码语言:javascript
复制
<?php $userinfo = Yii::app()->facebook->getInfo() // gets the Graph info of the current user ?>

but it gives me error
Property "LoginButton.oauth" is not defined. 

i am follwing this url to http://www.yiiframework.com/extension/facebook-opengraph/
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-06-02 02:21:57

oauth属性不是在小部件中分配的,而是在配置文件(很可能是main.php)的组件数组中分配的。

代码语言:javascript
复制
'components'=>array(
  'facebook'=>array(
    'class' => 'ext.yii-facebook-opengraph.SFacebook',
    'appId'=>'YOUR_FACEBOOK_APP_ID', // needed for JS SDK, Social Plugins and PHP SDK
    'secret'=>'YOUR_FACEBOOK_APP_SECRET', // needed for the PHP SDK 
    //'locale'=>'en_US', // override locale setting (defaults to en_US)
    //'jsSdk'=>true, // don't include JS SDK
    //'async'=>true, // load JS SDK asynchronously
    //'jsCallback'=>false, // declare if you are going to be inserting any JS callbacks to the async JS SDK loader
    //'status'=>true, // JS SDK - check login status
    //'cookie'=>true, // JS SDK - enable cookies to allow the server to access the session
    //'oauth'=>true,  // JS SDK -enable OAuth 2.0
    //'xfbml'=>true,  // JS SDK - parse XFBML / html5 Social Plugins
    //'html5'=>true,  // use html5 Social Plugins instead of XFBML
    //'ogTags'=>array(  // set default OG tags
        //'title'=>'MY_WEBSITE_NAME',
        //'description'=>'MY_WEBSITE_DESCRIPTION',
        //'image'=>'URL_TO_WEBSITE_LOGO',
    //),
  ),
),
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10846790

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档