nim888
nim888
  • 发布:2016-03-09 14:38
  • 更新:2016-05-26 15:53
  • 阅读:2890

微信登录失败[-2] 用户取消

分类:HTML5+

我拿你们实例真机调试是没有问题,但打包后就不行。
var auths={};
function plusReady(){
// 获取登录认证通道
plus.oauth.getServices(function(services){
var content=document.getElementById('dcontent');
var info=document.getElementById("info");
var txt="登录认证通道信息:";
for(var i in services){
var service=services[i];
console.log(service.id+": "+service.authResult+", "+service.userInfo);
auths[service.id]=service;
txt += "id:"+service.id+", ";
txt += "description:"+service.description+", ";
var de=document.createElement('div');
de.setAttribute('class','button');
de.setAttribute('onclick','login(this.id)');
de.id=service.id;
de.innerText=service.description+"登录";
oauth.appendChild(de);
}
info.innerText=txt;
},function(e){
outLine("获取登录认证失败:"+e.message);
});
}
document.addEventListener('plusready',plusReady,false);
// 登录认证
function login(id){

if(auth){  
    var w=null;  
    if(plus.os.name=="Android"){  
        w=plus.nativeUI.showWaiting();  
    }  
    document.addEventListener("pause",function(){  
        setTimeout(function(){  
            w&&w.close();w=null;  
        },2000);  
    }, false );  
    auth.login(function(){  
        w&&w.close();w=null;  
        outLine("登录认证成功:");  
        outLine(JSON.stringify(auth.authResult));  
        userinfo(auth);  
    },function(e){  
        w&&w.close();w=null;  
        outLine("登录认证失败:");  
        outLine("["+e.code+"]:"+e.message);  
        plus.nativeUI.alert("详情错误信息请参考授权登录(OAuth)规范文档:http://www.html5plus.org/#specification#/specification/OAuth.html",null,"登录失败["+e.code+"]:"+e.message);  
    });  
}else{  
    outLine("无效的登录认证通道!");  
    plus.nativeUI.alert("无效的登录认证通道!",null,"登录");  
}  

}
// 获取用户信息
function userinfo(a){
outLine("----- 获取用户信息 -----");
a.getUserInfo(function(){
outLine("获取用户信息成功:");
outLine(JSON.stringify(a.userInfo));
var nickname=a.userInfo.nickname||a.userInfo.name;
plus.nativeUI.alert("欢迎“"+nickname+"”登录!");
},function(e){
outLine("获取用户信息失败:");
outLine("["+e.code+"]:"+e.message);
plus.nativeUI.alert("获取用户信息失败!",null,"登录");
});
}
// 注销登录
function logoutAll(){

for(var i in auths){  
    logout(auths[i]);  
}  

}
function logout(auth){
auth.logout(function(){
outLine("注销\""+auth.description+"\"成功");
},function(e){
outLine("注销\""+auth.description+"\"失败:"+e.message);
});
}

2016-03-09 14:38 负责人:无 分享
已邀请:
nim888

nim888 (作者)

我发现不光是登录不能通过,支付也不行。
我有些疑问:
1.是不是要设置权限

  1. 能否提供有登录和支付成功的manifest.json配置文件。

折腾有些天了,一直没有进展。

怎么联系你们技术支持。我的手机是:15901947275,QQ:84859195

二小

二小

这个问题解决了吗、我也遇到-2问题

该问题目前已经被锁定, 无法添加新回复