nnt 大佬有话说 :
【教程】OneDrive-Index-Cloudflare-Worker获取refresh_token失败BUG修复
原文地址:https://blog.1234234.xyz/archives/24/
仓库地址:https://github.com/heymind/OneDrive-Index-Cloudflare-Worker
安装过程请看仓库README,这里不做赘述
由于前段时间:dd.1234234.xyz的onedrive节点突然异常,访问限制`Worker threw exception`,我第一时间还以为是账号出啥情况了,在debug之后发现原来是有段时间由于该节点一直没人访问,导致refresh_token过期失效了,报错信息如下:
{"error":"invalid_grant","error_description":"AADSTS700082: The refresh token has expired due to inactivity. The token was issued on 2021-04-09T20:24:13.7429736Z and was inactive for 90.00:00:00.rnTrace ID: fc3c1f0d-acf2-497c-ba0f-9d7087f63900rnCorrelation ID: 9ecc7d33-6640-4f96-979e-729c0081f737rnTimestamp: 2021-09-05 19:12:37Z","error_codes":,"timestamp":"2021-09-05 19:12:37Z","trace_id":"fc3c1f0d-acf2-497c-ba0f-9d7087f63900","correlation_id":"9ecc7d33-6640-4f96-979e-729c0081f737","error_uri":"https://login.microsoftonline.com/error?code=700082"}
故而尝试重新获取一个新的值,在该过程中遇到了如下BUG:
{"error":"invalid_request","error_description":"AADSTS9002326: Cross-origin token redemption is permitted only for the ‘Single-Page Application’ client-type.rnTrace ID: 5f4789ca-3de2-4dd1-8060-9bfff1d33b00rnCorrelation ID: b546ee9d-faf8-4b35-8a69-9a856521e566rnTimestamp: 2021-09-05 19:07:51Z","error_codes":,"timestamp":"2021-09-05 19:07:51Z","trace_id":"5f4789ca-3de2-4dd1-8060-9bfff1d33b00","correlation_id":"b546ee9d-faf8-4b35-8a69-9a856521e566","error_uri":"https://login.microsoftonline.com/error?code=9002326"}
这里记录下如何解决:首先还是一样,获取一个Code值,在图中的client id填入对应的值后点击Authorize:
https://i.loli.net/2021/09/06/NFCrmpWdBxs6zjH.png
在获取到Code后我们便开始获取refresh_token,填入我们的client_secret:
https://i.loli.net/2021/09/06/lb1GAczI7R3Z2Wq.png
这时候先别急着点GET TOKEN,我们打开BurpSuite(抓包工具,此处可以替换为其他软件)进行抓包:
https://i.loli.net/2021/09/06/gAp1MXct829VJ3k.png
右键将数据发送到repeater重复模块:
https://i.loli.net/2021/09/06/vcKrzSNMUJgVHYW.png
删除其中的origin字段后点击Go:
https://i.loli.net/2021/09/06/7MLiUabHDoWdyCv.png
成功获取:
https://i.loli.net/2021/09/06/7yashAeQ3KL9olZ.png
breakmyheart 大佬有话说 :
绑定
hjvn2211445 大佬有话说 :
refresh token大概是3个月有效,每次刷新access token会同时生成一个新的refresh token
之前oneindex白屏的情况就是没有把新的refresh token写进配置,
如果有用oneindex的,请参考这文章
解决oneindex显示空白页/白屏问题
nnt 大佬有话说 :
hjvn2211445 大佬有话说 : 2021-9-6 03:44
refresh token大概是3个月有效,每次刷新access token会同时生成一个新的refresh token
之前oneindex白屏 …
这个worker版貌似没办法更新,除非得改改,从worker的KV 命名空间获取refresh tokenhttps://cdn.jsdelivr.net/gh/master-of-forums/master-of-forums/public/images/patch.gif
hanweizhe 大佬有话说 :
技术贴 当赏
sunete 大佬有话说 :
不访问就会失效,加个监控就好了吧?
xjjmjj 大佬有话说 :
知识帖,绑定。
CACss 大佬有话说 :
好的