Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

是否考虑增加自动刷新token功能 #141

Closed
xmcp opened this issue May 29, 2024 · 21 comments
Closed

是否考虑增加自动刷新token功能 #141

xmcp opened this issue May 29, 2024 · 21 comments

Comments

@xmcp
Copy link

xmcp commented May 29, 2024

小程序使用的access token有效期为864000秒(10天),但是过期时会自动刷新。刷新API大概长这样:

POST https://zj.haier.net/api-gw/oauthserver/account/v1/refreshToken HTTP/1.1
content-type: application/json;charset=UTF-8
...

{"refreshToken": "【refresh token】"}
HTTP/1.1 200 OK
Content-Type: application/json
...

{
    "retCode": "00000",
    "retInfo": "操作成功",
    "data": {
        "tokenInfo": {
            "accountToken": "【新的access token】",
            ...
        }
    }
}

其中refresh token在登录的时候可以抓到。是 https://zj.haier.net/api-gw/oauthserver/applet/v3/login/onekey 这个URL。

是否打算考虑当access token失效的时候用refresh token自动刷新access token?如果欢迎PR的话我可以看看怎么弄。

@xmcp
Copy link
Author

xmcp commented May 29, 2024

xmcp@a33bb4f 本地测了一下这个API似乎能用

@banto6
Copy link
Owner

banto6 commented May 30, 2024

see #135 (comment)

@xmcp
Copy link
Author

xmcp commented May 30, 2024

所以长期来说还是打算迁移会app的api?如果暂时搁置的话那我先实现一个小程序api的token续期,这样至少不用每周重新抓包了

@banto6
Copy link
Owner

banto6 commented May 30, 2024

小程序没有refresh token如何续期?

不好意思,没注意看前面的内容,onekey这个接口确实被我忽略了,我是基于app的refresh token去刷新的,但是由于我私仓已经有这部分刷新的逻辑了,所以我暂时不会接受PR。

@banto6
Copy link
Owner

banto6 commented May 30, 2024

我测试一下小程序onekey中的refresh token是否有效,有效的话我会这部分逻辑推上来,到时releasede时候我会加上您,您看方便吗

@banto6
Copy link
Owner

banto6 commented May 30, 2024

测试确实是可用的,已推送到master

@xmcp
Copy link
Author

xmcp commented May 30, 2024

嗯可以。我这个写得也有点问题,出错刷新之后并没有去重试之前的请求,不合并PR是对的😂

@banto6
Copy link
Owner

banto6 commented May 30, 2024

v1.1.0 已发布,感谢分享

@banto6 banto6 closed this as completed May 30, 2024
@roycho93
Copy link

已成功,感谢refreshToken分享。

@grouse108
Copy link

已更新,感谢两位大佬!!!

@xianzl
Copy link

xianzl commented May 31, 2024

已成功,感谢两位大佬!!

@hanmeng901105
Copy link

大佬,refresh token怎么获取,抓包没抓到

@littlesky87
Copy link

大佬,refresh token怎么获取,抓包没抓到

先退出后再重新登录,抓 https://zj.haier.net/api-gw/oauthserver/applet/v3/login/onekey 这个请求,看它的返回内容。

@DynamicCN
Copy link

DynamicCN commented May 31, 2024

Mac 没抓到 onekey 这个接口,我是重新登录然后在https://zj.haier.net/api-gw/oauthserver/applet/v3/login/sms这个接口中找到了 refresh token
WechatIMG10429

@okwelcome
Copy link

Mac 没抓到 onekey 这个接口,我是重新登录然后在https://zj.haier.net/api-gw/oauthserver/applet/v3/login/sms这个接口中找到了 refresh token WechatIMG10429

搞定

@bloodmao1
Copy link

Mac 没抓到 onekey 这个接口,我是重新登录然后在https://zj.haier.net/api-gw/oauthserver/applet/v3/login/sms这个接口中找到了 refresh token WechatIMG10429

搞定

小程序用短信登录应该是从这个接口获取 refresh token,按此方法操作成功,感谢

@kiss2u
Copy link

kiss2u commented Jun 4, 2024

大佬,refresh token怎么获取,抓包没抓到

先退出后再重新登录,抓 https://zj.haier.net/api-gw/oauthserver/applet/v3/login/onekey 这个请求,看它的返回内容。

比如proxypin,安装完证书,开启抓包,点击登录就始终转圈,关闭抓包就能正常收到短信,这个怎么办亚?

@littlesky87
Copy link

大佬,refresh token怎么获取,抓包没抓到

先退出后再重新登录,抓 https://zj.haier.net/api-gw/oauthserver/applet/v3/login/onekey 这个请求,看它的返回内容。

比如proxypin,安装完证书,开启抓包,点击登录就始终转圈,关闭抓包就能正常收到短信,这个怎么办亚?

我在 iOS 上使用 Stream 抓包正常,不行的话你用上面的朋友提到的 https://zj.haier.net/api-gw/oauthserver/applet/v3/login/sms 这个接口试一下

@kiss2u
Copy link

kiss2u commented Jun 4, 2024

比如小程序,是抓包微信吧?还是抓包海尔智家app?后者我可以成功抓包,但是小程序总是失败。

@littlesky87
Copy link

比如小程序,是抓包微信吧?还是抓包海尔智家app?后者我可以成功抓包,但是小程序总是失败。

抓小程序的包,就是微信。插件现在用的小程序接口,抓 app 是没用的。

@huangshenqiong
Copy link

这个抓到了如何使用?小白不懂打扰了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests