大兄弟,。。。这玩意都改了,只能通过按钮用户自己授权才能够获得,自己调用api毛线用都没有
微信升级到8.0.6之后,小程序web-view,引入jssdk,wx.getLocation报错报错如图,wx.config都成功了,为什么wx.getlocation会单独报invalid signature。我这里还试过微信8.0.1版本可以获取经纬度,其他人报错都是8.0.6版本,我一升级8.0.6也报错了。 [图片][图片]
2021-06-04貌似只能通过按钮。。。那这个授权查询就相当废了?
小程序button授权组件不弹弹框,而且wx.getSetting获取不到用户授权信息。[图片] [图片] [图片] 点击授权button,没有拿到scope.userInfo,之前是可以的,下午就突然不行了
2021-06-04public Object getPhoneNumber(String session_key, String encryptedData, String iv) throws UnsupportedEncodingException{ String session_key1=session_key.replace(" ","+"); String encryptedData1=encryptedData.replace(" ","+"); String iv1=iv.replace(" ","+"); byte[] encrypData =Base64.getDecoder().decode(encryptedData1); byte[] ivData =Base64.getDecoder().decode(iv1); byte[] keyByte=Base64.getDecoder().decode(session_key1); AlgorithmParameterSpec ivSpec = new IvParameterSpec(ivData); String resultString = null; try { int base = 16; if (keyByte.length % base != 0) { int groups = keyByte.length / base + (keyByte.length % base != 0 ? 1 : 0); byte[] temp = new byte[groups * base]; Arrays.fill(temp, (byte) 0); System.arraycopy(keyByte, 0, temp, 0, keyByte.length); keyByte = temp; } Security.addProvider(new BouncyCastleProvider()); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); SecretKeySpec keySpec = new SecretKeySpec(keyByte, "AES"); cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); resultString = new String(cipher.doFinal(encrypData), "UTF-8"); } catch (Exception e) { e.printStackTrace(); } JSONObject object = JSONObject.parseObject(resultString); return object.getString("purePhoneNumber"); } //这都运行不了那把小程序砸了
如何获取微信用户的手机号?此段代码原先可以获取到微信用户的手机号,现在解密后的信息中没有手机号码了,是什么原因 byte[] encrypData = Base64Utils.decodeFromString(encryptedData); byte[] ivData = Base64Utils.decodeFromString(iv); byte[] sessionKey = Base64Utils.decodeFromString(key); AlgorithmParameterSpec ivSpec = new IvParameterSpec(ivData); String resultString = null; try { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); SecretKeySpec keySpec = new SecretKeySpec(sessionKey, "AES"); // 设置为解密模式 cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); resultString = new String(cipher.doFinal(encrypData), "UTF-8"); } catch (Exception e) { e.printStackTrace(); } JSONObject object = JSONObject.parseObject(resultString); //获取用户登录的手机号码 return object.getString("purePhoneNumber");
2021-06-04