2015-02-10 89 views
-1

我试图做使用hello.js雅虎的Oauth。请找我的代码,我已经写了:hello.js雅虎API集成

window.onload = function() 
{ 
hello.init(
{ 
    // "yahoo" : "M0FZ5t7i" 
    "yahoo" : "dj0yJmk9WGJDUHpwMkxBNUxEJmQ9WVdrOU4xcFBZVUo1TldrbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1jMw--" 
}, 
{ 
    redirect_uri:'staging.name.com', 
    oauth_proxy: "https://auth-server.herokuapp.com/proxy" 
    //https://auth-server.herokuapp.com/ https://auth-server.herokuapp.com/proxy 
}); 

} 

和我加入了一个按钮,点击:

hello("yahoo").login().then(function() 
    { 
     // Get Profile 
     return hello("yahoo").api('me'); 
    }).then(function(p) 
    { 
     console.log(p.name); 

    }).then(null, function(e){ 
     console.error(e); 
     alert(e); 
    }); 

我越来越无效凭证。另外我的问题是在client_id,我应该使用消费者密钥或Appid?

我也https://auth-server.herokuapp.com/添加为代理。它应该包含哪些字段值?此外,域和参考是什么意思?

+1

德鲁给你下面一个答案,就是它有什么用途呢?这是通常在这里给予好评和/或接受都是有用的答案,所以佣工得到鼓励进行帮助的一点点,让我知道,如果你想知道该怎么做。 – halfer 2015-11-02 21:29:21

+0

Downvoted,看到一个波夫。 – halfer 2015-11-28 10:24:34

回答

2
  • client_id应该是OAuth1中的consumer_key。
  • domain应该在你的情况staging.name.com
  • reference是arbitary值,即 “本地雅虎”

您的redirect_uri值应该是一个完整的URI(即http://staging.name.com/redirect.html。或相对路径。