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条)

报告相同问题?

悬赏问题

  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗