dongzao4503 2012-09-28 08:55
浏览 36
已采纳

Yii OAuth实施

Requiremen :- Yii, OAuth implemenation to authenticate and fetch user data. I found out that there are two extensions. Eauth(support OAuth 2.0 and other social networking sites) and Eoauth(OAuth 1.0). Correct me If i am wrong.

I dont have to authenticate any social networking site. It's a different url from where I need to get the data.

Now i could successfully login and authenticate using "eoauth" extension but also I need to fetch information about the user. I don't find any function or way how to fetch data from url which lies under OAuth layer. Does Eauth or Eoauth supports fetching or it has to be custom coded ? If this extensions does not do this then what is the other way I can authenticate and fetch data ?

  • 写回答

2条回答 默认 最新

  • duankun9280 2013-02-26 07:05
    关注

    Though Old but You just need to use CURL request to the end URL and you will get your data. I guess those modules doesn't have the function to fetch a data. I hope this might help you. I have used in one of my code and It was successful

    public function GetData($url){
            $signatureMethod = new OAuthSignatureMethod_HMAC_SHA1();
            $request = OAuthRequest::from_consumer_and_token($this->consumer,$this->token, 'GET',    $url, array());
            $request->sign_request($signatureMethod, $this->consumer, $this->token);        
            $fetchUrl = $request->to_url();
            $response = Yii::app()->CURL->run($fetchUrl);     
            return json_decode($response);               
        }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失