PinkD / corplink-rs

使用 rust 实现的飞连客户端
GNU General Public License v2.0
194 stars 26 forks source link

thread 'main' panicked at src/main.rs:98:29: called `Result::unwrap()` on an `Err` value: #36

Open honestAnt opened 3 weeks ago

honestAnt commented 3 weeks ago

目前使用ldap方式认证,账号密码没问题,使用飞连的网页端也能登录,但是用这个报错(感觉是请求时缺少token参数导致的),请帮忙看看,谢谢!

thread 'main' panicked at src/main.rs:98:29: called Result::unwrap() on an Err value: ReqwestError(reqwest::Error { kind: Decode, source: Error("missing field token", line: 1, column: 678) })


环境: macos 13.5.2 corplink-rs: 0.4.3 config.json { "company_name": "xxxxx", "username": "xxxxxxxx", "password": "xxxxxxx", "platform": "ldap", "code": null, "device_name": "DollarOS", "device_id": "xxxx", "public_key": "xxxxxx", "private_key": "xxxxxx", "server": "https://corplink.xxxx", "interface_name": "corplink", "debug_wg": null, "state": null, "vpn_server_name": null, "vpn_select_strategy": null }

PinkD commented 3 weeks ago

从你贴的 log 来看,是返回的登录方法里没有 token 字段 方法是这个 https://github.com/PinkD/corplink-rs/blob/43623314016c0259dc94a2ec924e9b40ba48cfec/src/client.rs#L456-L461 返回是这个 https://github.com/PinkD/corplink-rs/blob/43623314016c0259dc94a2ec924e9b40ba48cfec/src/resp.rs#L32-L37 你可以试试参考这个,把 token 字段变成可选项 https://github.com/PinkD/corplink-rs/blob/43623314016c0259dc94a2ec924e9b40ba48cfec/src/resp.rs#L1-L11

honestAnt commented 3 weeks ago

谢谢告知