Use the GEWE framework to complete the creation of a new device and scan the code to log in, based on the IPAD8040 version development

Friendship link of GEWE framework, geweapi.com can be accessed by clicking.

create new device

A brief description:

  • When you log in to WeChat for the first time, you need to call this interface to create a device. After you log in again, you can directly use the previously created device ID to call the login QR code interface to log in.
  • The same account avoids frequently creating new device logins, which can easily trigger risk control

Request URL:

  • http://domain name address/api/login/createapp

    Request method:

  • POST

    Request header:

  • Content-Type:application/json

  • X-GEWE-TOKEN: background acquisition

    parameter:

parameter name required type of data illustrate
regions yes string Wechat login region ID, please select the nearest region when logging in, currently supports the following regions:
110000 Beijing 120000 Tianjin 130000 Hebei Province 140000 Shanxi Province 310000 Shanghai 320000 Jiangsu Province 330000 Zhejiang Province 340000 Anhui Province 350000 Fujian Province 360000 Jiangxi Province 370000 Shandong Province 410000 Henan Province 420000 Hubei Province 430000 Hunan Province 440000 Guangdong Province 460000 Hainan Province 500000 Chongqing City 510000 Sichuan Province 530000 Yunnan Province 610000 Shaanxi Province

return data:

parameter name type of data illustrate
ret number 0: success
msg string Feedback
data object
appid string Appid is equivalent to a cloud device

Example request parameters:

   {
       "regionid": "320000"
   }

Example of successful return:

    {
        "ret": 0,
        "msg": "success",
        "data": {
            "appid": "wx_nScLwnZhfNmlQlL0npc71"
        }
    }

Example error return:

    {
        "ret": 400,
        "msg_err": "regionid不存在,请检查参数!"
    }

Get login QR code

Request URL:

  • http://domain name address/api/login/getloginqrcode

    Request method:

    • POST

      Request header:

  • Content-Type:application/json

  • X-GEWE-TOKEN: background acquisition

    parameter:

parameter name required type of data illustrate
appid yes string The device id, the logged-in WeChat ID, and the previously logged-in appid will be passed to fetch the code when logging in again
regions no string Wechat login region ID, please select the nearest region when logging in, the following regions are currently supported. The last login area is used by default:
110000 Beijing 120000 Tianjin 130000 Hebei 140000 Shanxi 310000 Shanghai 320000 Jiangsu 330000 Zhejiang 340000 Anhui 350000 Fujian 360000 Jiangxi 370000 Shandong 410000 Henan 420 000 Hubei Province 430000 Hunan Province 440000 Guangdong Province 460000 Hainan Province 500000 Chongqing City 510000 Sichuan Province 530000 Yunnan Province 610000 Shaanxi Province

return data:

parameter name type of data illustrate
ret number 0: success
msg string Feedback
data object
base64 string The base64 of the QR code image
uuid string The uuid returned by the code fetch interface
one string The nkey returned by the code fetch interface

Example request parameters:

   {
       "appid": "wx_nScLwnZhfNmlQlL0npc71",
       "regionid": "320000"
   }

Example of successful return:

    {
    "ret": 0,
    "msg": "success",
    "data": {
        "base64": "data:image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYID",
        "uuid": "4fgut3ILSLNMtoxW2RUc",
        "nkey": "httig9elPZ3SwZ3GWtdxzA=="
    }
}

Example error return:

{
    "ret": -1,
    "msg": "fail",
    "msg_err": "[wx_ECMY4oEDuQAP6impWwWv]设备不存在"
}

Execute login

A brief description:

  • This interface needs to be called cyclically after the code is fetched, and the interval between each call is not less than 5s. After the interface returns the personal information for logging in to WeChat, the login is successful. After the login is successful, this interface cannot continue to be called

Request URL:

  • http://domain name address/api/login/checkloginqrcode

    Request method:

    • POST

      Request header:

  • Content-Type:application/json

  • X-GEWE-TOKEN: background acquisition

    parameter:

parameter name required type of data illustrate
appid yes string device id
one yes string The nkey returned by the code fetch interface
uuid yes string The uuid returned by the code fetch interface

return data:

parameter name type of data illustrate
ret number 0: success
msg string Feedback
msg_err string Feedback error message
data object
data.status_info.headImgUrl string Avatar (after scanning the QR code on WeChat, this interface will return)
data.status_info.nickName string Nickname (after scanning the QR code on WeChat, this interface will return)
data.status_info.expiredTime int QR code expiration time, in seconds, this interface cannot be called after expiration
data.login_info.acctSectResp.userName string WeChat ID (returned after successful login)
data.login_info.acctSectResp.nickName string Nick name
data.login_info.acctSectResp.bindMobile string Bind mobile phone number
data.login_info.acctSectResp.alias string We chat number

Example request parameters:

   {
       "appid": "wx_nScLwnZhfNmlQlL0npc71",
       "nkey": "httig9elPZ3SwZ3GWtdxzA",
       "uuid": "4fgut3ILSLNMtoxW2RUc"
   }

Example of successful return (the mobile phone has scanned the code but has not clicked to log in):

    {
        "ret": 0,
        "msg": "success",
        "data": {
            "status_info": {
                "uuid": "gf3ib31m1lV0Xufy3X_Y",
                "status": 2,
                "headImgUrl": "http://wx.qlogo.cn/mmhead/ver_1/0AX8RNqDJiaNaSLSOGcLF0Z9VEMgBMwzGRDMCmCGBRwoiagjUVJqzVZyV94oGMcEmbrNf7u1tXVdgpdPaQ2kRJBpicgdVP4US93ULzGIbf6d4c/0",
                "pushLoginUrlexpiredTime": 604200,
                "nickName": "白开水加糖",
                "expiredTime": 207
            },
            "login_info": {
                "baseResponse": {
                    "ret": 0,
                    "errMsg": {
                        "string": "Everything is ok"
                    }
                },
                "unifyAuthSectFlag": 15,
                "acctSectResp": {
                    "userName": "wxid_8pddddddddt22",
                    "nickName": "白开水加糖",
                    "bindUin": 0,
                    "bindMobile": "18114484426",
                    "alias": "xmry0601",
                    "status": 102949,
                    "pluginFlag": 162017,
                    "regType": 2,
                    "safeDevice": 0,
                    "officialUserName": "weixin",
                    "officialNickName": "微信团队",
                    "pushMailStatus": 0,
                    "fsurl": "https://w.mail.qq.com/cgi-bin/login?uin=0&key=e85900408448109MTY4ODYzNTQwOQ&keytype=2&target=setremind&from=weixin&vt=weixin&f=xhtml"
                },
                "axAuthSecRespList": {
                    "count": 0
                }
            }
        }
    }

Example of successful return (the mobile phone has scanned the code and clicked to confirm the login):

    {
        "ret": 0,
        "msg": "success",
        "data": {
            "status_info": {
                "uuid": "gf3ib31m1lV0Xufy3X_Y",
                "status": 2,
                "headImgUrl": "http://wx.qlogo.cn/mmhead/ver_1/0AX8RNqDJiaNaSLSOGcLF0Z9VEMgBMwzGRDMCmCGBRwoiagjUVJqzVZyV94oGMcEmbrNf7u1tXVdgpdPaQ2kRJBpicgdVP4US93ULzGIbf6d4c/0",
                "pushLoginUrlexpiredTime": 604200,
                "nickName": "白开水加糖",
                "expiredTime": 207
            },
            "login_info": {
                "baseResponse": {
                    "ret": 0,
                    "errMsg": {
                        "string": "Everything is ok"
                    }
                },
                "unifyAuthSectFlag": 15,
                "acctSectResp": {
                    "userName": "wxid_8pddddddddt22",
                    "nickName": "白开水加糖",
                    "bindUin": 0,
                    "bindMobile": "18100002426",
                    "alias": "wxid_8pddddddddt22",
                    "status": 102949,
                    "pluginFlag": 162017,
                    "regType": 2,
                    "safeDevice": 0,
                    "officialUserName": "weixin",
                    "officialNickName": "微信团队",
                    "pushMailStatus": 0,
                    "fsurl": "https://w.mail.qq.com/cgi-bin/login?uin=0&key=e85900408448109MTY4ODYzNTQwOQ&keytype=2&target=setremind&from=weixin&vt=weixin&f=xhtml"
                },
                "axAuthSecRespList": {
                    "count": 0
                }
            }
        }
    }

Example error return:

    {
        "ret": -1,
        "msg_err": "微信已登陆,请勿重复调用。"
    }

Guess you like

Origin blog.csdn.net/weixin_36648445/article/details/132061685