Jas*_*ver 5 oauth-2.0 cordova hello.js
我已经开始和关闭了几个月的hello.js来使用我的PhoneGap应用程序.
现在只关注Google,当我在PhoneGap浏览器中重定向时,我发送了400错误;
Error: invalid_request
invalid parameter for redirect_uri: Missing authority
file:///android_asset/www/index.html
Run Code Online (Sandbox Code Playgroud)
我已经按照各种网站上的说明来帮助设置,但似乎没有什么能让我超越这个错误.
我的按钮:
<button onclick="hello( 'google' ).login()">google</button>
Run Code Online (Sandbox Code Playgroud)
我的javascript:
<script type="text/javascript" src="js/hello.all.js"></script>
<script>
hello.on('auth.login', function(auth){
// call user information, for the given network
hello( auth.network ).api( '/me' ).success(function(r){
var $target = $("#profile_"+ auth.network );
if($target.length==0){
$target = $("<div id='profile_"+auth.network+"'></div>").appendTo("#profile");
}
$target.html('<img src="'+ r.thumbnail +'" /> Hey '+r.name).attr('title', r.name + " on "+ auth.network);
});
});
hello.init({
google : 'MY_CLIENT_ID_IS_HERE.apps.googleusercontent.com'
},{redirect_uri:'TRIED_VARIOUS_THINGS_HERE'});
</script>
Run Code Online (Sandbox Code Playgroud)
我已经尝试了http:// localhost的重定向网址(没有空格,因为它在这里)我尝试了一个urn的重定向网址:ietf:wg:oauth:2.0:oob我尝试了一个仅重定向网址OOB
谷歌说我的重定向URIS是
REDIRECT URIS
urn:ietf:wg:oauth:2.0:oob
http://localhost
Run Code Online (Sandbox Code Playgroud)
在与Andrew Dodson交谈时,我认为他是hello.js的创造者,他说:
Its like redirect_uri hasn't been set, it defaults to window.location.href,
Run Code Online (Sandbox Code Playgroud)
他向我保证不需要jQuery,但我很好奇为什么引用var $ target = $("#profile _"+ auth.network); 在示例代码中?
我不使用jQuery,而只是喜欢Javascript解决方案.是否有人可以解释$的目的("...在上面的代码中,以及我如何在其中使用不同的代码?
非常感谢
| 归档时间: |
|
| 查看次数: |
1247 次 |
| 最近记录: |