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 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序