bypy icon indicating copy to clipboard operation
bypy copied to clipboard

授权失败,建议作者告知怎么自建认证服务器

Open 2010dainifei opened this issue 3 years ago • 20 comments

又认证失败了,现在认证经常失败,已经没法正常使用了。希望作者告知怎么搭建自建认证服务器的,这样我们自己可以搭建一下。。。。。。

2010dainifei avatar Oct 28 '21 00:10 2010dainifei

应该不用Auth 服务器 前提是你要把key 放到代码里面

duchenpaul avatar Nov 02 '21 12:11 duchenpaul

https://github.com/houtianze/bypy/blob/master/bypy/const.py#L132

duchenpaul avatar Nov 02 '21 12:11 duchenpaul

刚刚发布了最新版1.7.4,令牌授权和刷新的问题这次应该是比较彻底的解决了,可以升级试一试: pip install -U bypy

houtianze avatar Nov 22 '21 19:11 houtianze

自建认证服务器按这个来就好了,挺简单的:https://github.com/houtianze/bypyoauth 不过需要client secret。。 这次更新只留了两个我测试过没被墙的认证服务器,并且修正了令牌刷新逻辑,应该认证这块儿是不会有太大问题了。

houtianze avatar Nov 22 '21 20:11 houtianze

pip install -U bypy

自建认证服务器按这个来就好了,挺简单的:https://github.com/houtianze/bypyoauth 不过需要client secret。。 这次更新只留了两个我测试过没被墙的认证服务器,并且修正了令牌刷新逻辑,应该认证这块儿是不会有太大问题了。

我尝试了这个东西,自己也有相关秘钥,但是就是没有搭建成功。惭愧。。。。稍微晚点我再试试。 另外想请教一下 如果搭建成功怎么才能连接到自己的私人服务器上进行验证。

2010dainifei avatar Nov 23 '21 01:11 2010dainifei

刚刚发布了最新版1.7.4,令牌授权和刷新的问题这次应该是比较彻底的解决了,可以升级试一试: pip install -U bypy

新版试过了 Authorizing, please be patient, it may take upto 300 seconds... Authorizing with the Vercel server ... Vercel server failed. Last resort: authorizing with the Aliyun server ... <E> [19:59:42] Fatal: All server authorizations failed.

vuens avatar Nov 23 '21 12:11 vuens

刚刚发布了最新版1.7.4,令牌授权和刷新的问题这次应该是比较彻底的解决了,可以升级试一试: pip install -U bypy

新版试过了,还是不行呢。 Authorizing, please be patient, it may take upto 300 seconds... Authorizing with the Vercel server ... Vercel server failed. Last resort: authorizing with the Aliyun server ... <E> [19:59:42] Fatal: All server authorizations failed.

vuens avatar Nov 23 '21 12:11 vuens

刚刚发布了最新版1.7.4,令牌授权和刷新的问题这次应该是比较彻底的解决了,可以升级试一试: pip install -U bypy

新版试过了,还是不行呢。 Authorizing, please be patient, it may take upto 300 seconds... Authorizing with the Vercel server ... Vercel server failed. Last resort: authorizing with the Aliyun server ... <E> [19:59:42] Fatal: All server authorizations failed.

是不是点回车前没有百度的授权码?

houtianze avatar Nov 25 '21 17:11 houtianze

想搭建并共享授权服务器说明在这: https://github.com/houtianze/bypy/blob/master/README.md?plain=1#L29-L37

houtianze avatar Nov 25 '21 18:11 houtianze

作者你好 我更新到1.75 目前可以正常授权登录,但是用refreshtoken时会报错

bypy list Please visit: https://openapi.baidu.com/oauth/2.0/authorize?authorizeauthorizeauthorizeauthorize And authorize this app Paste the Authorization Code here within 10 minutes. Press [Enter] when you are done 授权码授权码授权码授权码 Authorizing, please be patient, it may take upto 300 seconds... Authorizing with the Vercel server ... Successfully authorized /apps/bypy ($t $f $s $m $d):

bypy refreshtoken Refreshing, please be patient, it may take upto 300 seconds... <E> [22:48:26] Waiting 10 seconds before retrying... <E> [22:48:36] Request Try #2 / 5 <E> [22:48:36] Waiting 20 seconds before retrying... <E> [22:48:56] Request Try #3 / 5 <E> [22:48:57] Waiting 30 seconds before retrying... <E> [22:49:27] Request Try #4 / 5 <E> [22:49:27] Waiting 40 seconds before retrying... <E> [22:50:07] Request Try #5 / 5 <E> [22:50:07] Maximum number (5) of tries failed. <E> [22:50:07] ---------------------------------------------------------------- Error 140: Maximum retries reached

bypy refreshtoken命令执行时 只会访问139.198.178.38 220.181.107.142这两个国内ip。

zyOverture avatar Nov 26 '21 15:11 zyOverture

Press [Enter] when you are done

Authorizing, please be patient, it may take upto 300 seconds...
Authorizing with the Vercel server ...
Vercel server failed. Last resort: authorizing with the Aliyun server ...
<E> [23:38:48] Fatal: All server authorizations failed.
<I> [23:38:48] ----------------------------------------------------------------
<I> [23:38:48] This is most likely caused by authorization errors.
Possible causes:
 - You didn't run this program for a long time (more than a month).
 - You changed your Baidu password after authorizing this program.
 - You didn't give this program the 'netdisk' access while authorizing.
 - ...
Possible fixes:
 1. Remove the authorization token by running with the parameter '-c', and then re-run this program.
 2. If (1) still doesn't solve the problem, you may have to go to:
    https://passport.baidu.com/accountbind
    and remove the authorization of this program, and then re-run this program.
root@debian10:~# bypy -c
<E> [23:39:03] Fail to remove local fle '/root/.bypy/bypy.json'.
Exception:
<class 'FileNotFoundError'> - [Errno 2] No such file or directory: '/root/.bypy/bypy.json'
Stack:
  File "/usr/local/bin/bypy", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/bypy/bypy.py", line 3688, in main
    return clean_prog_files(args.clean, args.verbose, args.configdir)
  File "/usr/local/lib/python3.7/dist-packages/bypy/bypy.py", line 3591, in clean_prog_files
    result = removefile(tokenpath, verbose)
  File "/usr/local/lib/python3.7/dist-packages/bypy/util.py", line 138, in removefile
    path, formatex(ex)))
  File "/usr/local/lib/python3.7/dist-packages/bypy/util.py", line 73, in formatex
    type(ex), ex, ''.join(traceback.format_stack()))

<E> [23:39:03] Failed to remove the token file '/root/.bypy/bypy.json'
<E> [23:39:03] You need to remove it manually
<E> [23:39:03] Fail to remove local fle '/root/.bypy/bypy.parts.json'.
Exception:
<class 'FileNotFoundError'> - [Errno 2] No such file or directory: '/root/.bypy/bypy.parts.json'
Stack:
  File "/usr/local/bin/bypy", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/bypy/bypy.py", line 3688, in main
    return clean_prog_files(args.clean, args.verbose, args.configdir)
  File "/usr/local/lib/python3.7/dist-packages/bypy/bypy.py", line 3600, in clean_prog_files
    subresult = removefile(prgrpath, verbose)
  File "/usr/local/lib/python3.7/dist-packages/bypy/util.py", line 138, in removefile
    path, formatex(ex)))
  File "/usr/local/lib/python3.7/dist-packages/bypy/util.py", line 73, in formatex
    type(ex), ex, ''.join(traceback.format_stack()))

<E> [23:39:03] Failed to remove the progress file '/root/.bypy/bypy.parts.json'

vuens avatar Nov 26 '21 15:11 vuens

@zyOverture 谢谢反馈。是这次改动的问题,本来以为refresh_token不需要client_secret,后来查了一下还是需要。。等我有时间尽快修正。。

houtianze avatar Nov 27 '21 02:11 houtianze

我刚刚也发现了这个问题,期待楼主的修复,辛苦

JavisPeng avatar Nov 27 '21 12:11 JavisPeng

自建认证服务器按这个来就好了,挺简单的:https://github.com/houtianze/bypyoauth 不过需要client secret。。 这次更新只留了两个我测试过没被墙的认证服务器,并且修正了令牌刷新逻辑,应该认证这块儿是不会有太大问题了。

已经搭建完成,我将贡献2台服务器,但是我发现好像只能本地访问。需要楼主帮忙一起看一下怎么集成到项目里面。QQ:1127653664

2010dainifei avatar Nov 28 '21 10:11 2010dainifei

@zyOverture @JavisPeng 最新版1.7.6应该已经修正了refreshtoken的问题

houtianze avatar Nov 29 '21 21:11 houtianze

自建认证服务器按这个来就好了,挺简单的:https://github.com/houtianze/bypyoauth 不过需要client secret。。 这次更新只留了两个我测试过没被墙的认证服务器,并且修正了令牌刷新逻辑,应该认证这块儿是不会有太大问题了。

已经搭建完成,我将贡献2台服务器,但是我发现好像只能本地访问。需要楼主帮忙一起看一下怎么集成到项目里面。QQ:1127653664

@2010dainifei 感谢。 自建服务器步骤在这里: https://github.com/houtianze/bypy/blob/master/README.md?plain=1#L29-L37

houtianze avatar Nov 29 '21 21:11 houtianze

自建认证服务器按这个来就好了,挺简单的:https://github.com/houtianze/bypyoauth 不过需要client secret。。 这次更新只留了两个我测试过没被墙的认证服务器,并且修正了令牌刷新逻辑,应该认证这块儿是不会有太大问题了。

已经搭建完成,我将贡献2台服务器,但是我发现好像只能本地访问。需要楼主帮忙一起看一下怎么集成到项目里面。QQ:1127653664

@2010dainifei 感谢。 自建服务器步骤在这里: https://github.com/houtianze/bypy/blob/master/README.md?plain=1#L29-L37

已经根据教程完成了搭建,我就不提交代码了,你直接加入吧。 域名: bypyauth_1.yjxfz.com:9900 bypyauth_2.yjxfz.com:9900 bypyauth_3.yjxfz.com:9900 以上域名请先加入,可能暂时会认证不通,后面我会逐个调整加入。目前3个服务器IP设置的都是一样的,等待 认证通过后我将把域名重新解析到不同的服务器上。因为暂时没有搞明白这个本地认证的原理,所以为了安全方面考虑 麻烦楼主 给提供一下 BAIDU_API_KEY和BAIDU_API_SECRET 参数。 另外还是希望作者可以和我私下联系一下,遇到问题可以快速解决。谢谢

2010dainifei avatar Nov 30 '21 03:11 2010dainifei

已经根据教程完成了搭建,我就不提交代码了,你直接加入吧。 域名: bypyauth_1.yjxfz.com:9900 bypyauth_2.yjxfz.com:9900 bypyauth_3.yjxfz.com:9900 以上域名请先加入,可能暂时会认证不通,后面我会逐个调整加入。目前3个服务器IP设置的都是一样的,等待 认证通过后我将把域名重新解析到不同的服务器上。因为暂时没有搞明白这个本地认证的原理,所以为了安全方面考虑 麻烦楼主 给提供一下 BAIDU_API_KEY和BAIDU_API_SECRET 参数。 另外还是希望作者可以和我私下联系一下,遇到问题可以快速解决。谢谢

好的,谢谢。我试了一下:

  • 现在都还无法联通?
  • 为了用户token安全,能配成https协议吗?
  • bypyoauth那个库我昨天更新了一下(上一次更新把refresh_token错误的拿掉了,导致用户无法刷新令牌),你可能需要git pull一下拉取最新的代码再跑起来。

私聊进这里试试? https://gitter.im/houtianze/bypy

houtianze avatar Nov 30 '21 07:11 houtianze

  • token安全,能配成https协议吗

1、已经可以联通,之前是我防火墙引起外网不能访问 2、怎么配置https ? 3、代码已经更新 4、已经私聊

2010dainifei avatar Nov 30 '21 08:11 2010dainifei

@2010dainifei 好的,我在gitter上和你私聊。

houtianze avatar Dec 01 '21 20:12 houtianze

最新版1.8授权服务器问题解决,无须再搭建了。

houtianze avatar Sep 23 '22 18:09 houtianze