function main() {
    let sessionId = args[0]

    let req = {
        "method": "POST",
        "url": "https://login.dingtalk.com/oauth2/generate_qrcode",
        "headers": {
            "referrer": "https://login.dingtalk.com/",
            "user-agent": "Mozilla/5.0 (X11; CrOS x86_64 8.8.260206) AppleWebKit"
        },
        "content_type": "application/x-www-form-urlencoded",
        "data": "client_id=dingtsp2ukmhfppwl6xy",
    }

    let res = request.parse(req)
    if (res.status_code != 200) {
        sse.send(sessionId, 'panic', '获取登录授权链接失败')
        return ''
    }

    var loginUrl = res.body.toObject().result
    let code = loginUrl.slice(-36)
    loginUrl = runtime.call('api/utils/sortUrl/function.js', loginUrl).short_url.short_url

    sse.send(sessionId, 'data', `{"code":"${code}", "url":"${loginUrl}"}`)

    return {
        code: code,
        url: loginUrl
    }
}