app支付宝授权登录获取用户信息

  由后台进行地址的拼接(前台进行授权)

// 生成授权的参数
        String sign = "";
        Long userId1 = SecurityUser.getUserId();
        String pid = "";
        String appid = "";
        String privateKey = "";
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("apiname=com.alipay.account.auth");
        stringBuffer.append("&app_id=");
        stringBuffer.append(appid);
        stringBuffer.append("&app_name=mc");
        stringBuffer.append("&auth_type=AUTHACCOUNT");
        stringBuffer.append("&biz_type=openservice");
        stringBuffer.append("&method=alipay.open.auth.sdk.code.get");
        stringBuffer.append("&pid=");
        stringBuffer.append(pid);
        stringBuffer.append("&product_id=APP_FAST_LOGIN");
        stringBuffer.append("&scope=kuaijie");
        stringBuffer.append("&sign_type=RSA2");
        stringBuffer.append("&target_id=");
        stringBuffer.append(userId1);
        sign = RSA.rsa2Sign(stringBuffer.toString(), "UTF-8", privateKey);
        stringBuffer.append("&sign="+ URLEncoder.encode(sign, "UTF-8"));
        return new Result().ok(stringBuffer.toString());

猜你喜欢

转载自www.cnblogs.com/chengyangyang/p/10450957.html