z***@126.com
z***@126.com
  • 发布:2018-12-02 22:01
  • 更新:2018-12-03 11:00
  • 阅读:3520

通过微信登录,小程序获取的openid与ios接口返回的openid不一致

分类:uni-app
<template>  
    <view style="padding:35px;">  
        <!-- #ifdef MP-WEIXIN -->  
        <button type="primary" open-type="getUserInfo" @getuserinfo="getuserinfo" withCredentials="true">微信登录1</button>  
        <!-- #endif -->  
        <!-- #ifdef APP-PLUS -->  
        <button type="primary" open-type="getUserInfo" @click="getuserinfoh5appwx" withCredentials="true">微信登录2</button>  
        <!-- #endif -->  
    </view>  
</template>  

<script>  
    var _self;  

    export default {  
        data() {  
            return {  
                title: '欢迎使用'  
            }  
        },  
        methods: {  
            getuserinfoh5appwx: function() {  
                _self = this;  
                uni.login({  
                    success: function(res2) {  
                        console.log(JSON.stringify(res2) + '2');  
                        uni.getUserInfo({  
                            success: function(res3) {  
                                console.log(JSON.stringify(res3) + '3');  
                            }  
                        })  
                    },  
                });  
            },  
            getuserinfo: function(res1) {  
                _self = this;  
                uni.login({  
                    success: function(res2) {  
                        uni.request({  
                            url: _self.url.login + "?code=" + res2.code,  
                            success: function(res3) {  
                                console.log(JSON.stringify(res3));  
                            }  
                        })  
                    }  
                });  
            }  
        }  
    }  
</script>  

<style>  
    .content {  
        text-align: center;  
        height: 400upx;  
    }  

    .logo {  
        height: 200upx;  
        width: 200upx;  
        margin-top: 200upx;  
    }  

    .title {  
        font-size: 36upx;  
        color: #8f8f94;  
    }  
</style>  

getuserinfoh5appwx与getuserinfo获取的openid不一致

2018-12-02 22:01 负责人:无 分享
已邀请:
DCloud_App_Array

DCloud_App_Array

通过不同接口获取的openid不一致应该是正常吧,这个值是由微信开放平台返回的数据,具体情况需要咨询微信技术支持。

  • z***@126.com (作者)

    那对于微信登录,小程序和ios,就无法判断为同一人。有什么解决方案吗?

    2018-12-05 08:47

  • z***@126.com (作者)

    unionid是判断多个公众号的,不满足这个场景

    2018-12-05 08:47

  • DCloud_App_Array

    这个得咨询下微信,在原生环境中客户端只是传递微信开放平台返回的值。

    2018-12-05 17:10

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