duanjiaopi8218 2013-07-02 23:46
浏览 110
已采纳

如何使用epicurl库为Twitter oAuth登录传递状态参数

I have thus far been able to transmit a state in Google+ oAuth2, and Yahoo oAuth2, and even myopenid. Now I am at the Twitter stage of my provider login project.

I am using the three classes developed by @jmathai (tutorial here).

My signin code looks very similar to this:

include 'EpiCurl.php';
include 'EpiOAuth.php';
include 'EpiTwitter.php';
$consumer_key = 'R4**Fw';
$consumer_secret = 'blp**Z8SA';

$Twitter = new EpiTwitter($consumer_key, $consumer_secret);

echo '<a href="' . $Twitter->getAuthorizeUrl() . '">
<img src="twitterButton.png" alt="sign in with twitter" />
</a>';

It works pretty well. But I need to pass some state parameters, like a client id, an origin page url, and some other junk.

I don't see how this is done with the epicurl libraries.

  • 写回答

1条回答 默认 最新

  • dongqiangou5724 2013-07-03 00:55
    关注

    Answering my own question. You can pass an entire query string, along with the url (although the page script should be the same as the callback page you specified in your Twitter app setup...I think).

    include 'twitter-async-master/EpiCurl.php';
    include 'twitter-async-master/EpiOAuth.php';
    include 'twitter-async-master/EpiTwitter.php';
    
    $consumer_key = 'R4kZPH********ZCtFw';
    $consumer_secret = 'blp***********************klFcZ8SA';
    
    $Twitter = new EpiTwitter($consumer_key, $consumer_secret);
    
    $callback = "http://www.talqo.com/twittercallback.php?callback=".urlencode($_GET['callback'])."&domain=".urlencode($_GET['domain'])."&page=".urlencode($_GET['page'])."&tid=".urlencode($_GET['tid'])."&height=".urlencode($_GET['height'])."&width=".urlencode($_GET['height']);
    
    $Twitter->setCallback($callback);
    

    ...and that's how it's done.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
  • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了