[GH-ISSUE #2851] 保存 SettingSync 提示“token invalid” #1871

Closed
opened 2026-02-27 00:05:09 +03:00 by kerem · 13 comments
Owner

Originally created by @zjl369 on GitHub (Jun 13, 2023).
Original GitHub issue: https://github.com/electerm/electerm/issues/2851

Electerm Version and download file extension(Electerm版本和下载文件后缀)

electerm-1.25.50-win-x64-installer.exe

Platform detail (平台详情)

Microsoft Windows NT 10.0.19045.0 x64

What steps will reproduce the bug?(重新问题的详细步骤)

通过 https://github.com/electerm/electerm/wiki/Create-personal-access-token 提供的链接,创建了具有 gist 权限的 token。

复制到 SettingSync 的 token 栏,并输入 gist id 后,点击保存,报错:token invalid。

下图中 gist 栏随便输的
Snipaste_2023-06-13_16-53-31

What should have happened?(期望的结果)

正常保存,并成功上传设置。

Would this happen in other terminal app(是否能够在其他同类软件重现这个问题)

No response

Additional information(其他任何相关信息)

No response

Originally created by @zjl369 on GitHub (Jun 13, 2023). Original GitHub issue: https://github.com/electerm/electerm/issues/2851 ### Electerm Version and download file extension(Electerm版本和下载文件后缀) electerm-1.25.50-win-x64-installer.exe ### Platform detail (平台详情) Microsoft Windows NT 10.0.19045.0 x64 ### What steps will reproduce the bug?(重新问题的详细步骤) 通过 [https://github.com/electerm/electerm/wiki/Create-personal-access-token](https://github.com/electerm/electerm/wiki/Create-personal-access-token) 提供的链接,创建了具有 gist 权限的 token。 复制到 SettingSync 的 token 栏,并输入 gist id 后,点击保存,报错:token invalid。 下图中 gist 栏随便输的 ![Snipaste_2023-06-13_16-53-31](https://github.com/electerm/electerm/assets/50287763/44b92f5a-c3ac-40e0-8c33-47f1ebc8600c) ### What should have happened?(期望的结果) 正常保存,并成功上传设置。 ### Would this happen in other terminal app(是否能够在其他同类软件重现这个问题) _No response_ ### Additional information(其他任何相关信息) _No response_
kerem 2026-02-27 00:05:09 +03:00
Author
Owner

@zjl369 commented on GitHub (Jun 13, 2023):

已经尝试过:
1、清屏重新粘贴 token;
2、重新生成 token;
3、删除原 token,创建新 token;
4、token 除了 gist 权限外,新增其他权限;
均无法正常保存......

<!-- gh-comment-id:1588874202 --> @zjl369 commented on GitHub (Jun 13, 2023): 已经尝试过: 1、清屏重新粘贴 token; 2、重新生成 token; 3、删除原 token,创建新 token; 4、token 除了 gist 权限外,新增其他权限; 均无法正常保存......
Author
Owner

@zxdong262 commented on GitHub (Jun 13, 2023):

初次使用不要填写id,填写id是你已经创建了一个gist,得到gist id,在其他机器使用或者需要恢复数据才填写,不是随便编写一个id的意思

<!-- gh-comment-id:1589221704 --> @zxdong262 commented on GitHub (Jun 13, 2023): 初次使用不要填写id,填写id是你已经创建了一个gist,得到gist id,在其他机器使用或者需要恢复数据才填写,不是随便编写一个id的意思
Author
Owner

@zjl369 commented on GitHub (Jun 14, 2023):

是我表述的不够清楚。

当时已经创建了 gist,并按照咱们的 wiki 填写了 gist id,保存报错“token invalid” 。
然后懒得截图马赛克了,就又随便填了个 id,保存截了个图。

不填 gist,也还是同样的错误。
Snipaste_2023-06-14_09-33-15

是我 token 创建的有问题吗?
image

其他权限都没选,只选了 gist。
image

我昨天是第一次下载安装 electerm,没有任何旧版信息。

<!-- gh-comment-id:1590309561 --> @zjl369 commented on GitHub (Jun 14, 2023): 是我表述的不够清楚。 当时已经创建了 gist,并按照咱们的 wiki 填写了 gist id,保存报错“token invalid” 。 然后懒得截图马赛克了,就又随便填了个 id,保存截了个图。 不填 gist,也还是同样的错误。 ![Snipaste_2023-06-14_09-33-15](https://github.com/electerm/electerm/assets/50287763/74c9bfbc-cceb-4d0f-b7eb-45346b7c3a74) 是我 token 创建的有问题吗? ![image](https://github.com/electerm/electerm/assets/50287763/e547bbc4-e68e-49ab-87c2-f9277dc7de63) 其他权限都没选,只选了 gist。 ![image](https://github.com/electerm/electerm/assets/50287763/7efd13e1-cea8-47d4-8148-772642be8fc4) 我昨天是第一次下载安装 electerm,没有任何旧版信息。
Author
Owner

@zxdong262 commented on GitHub (Jun 14, 2023):

我试了一下,重新创建token,把所有配置删除,相当于重新运行elelcterm,填写token保存,是可以的,这个错误信息可能不准确,也许是网络问题,有没有其他网络环境或者机器可以试试的。

<!-- gh-comment-id:1590332470 --> @zxdong262 commented on GitHub (Jun 14, 2023): 我试了一下,重新创建token,把所有配置删除,相当于重新运行elelcterm,填写token保存,是可以的,这个错误信息可能不准确,也许是网络问题,有没有其他网络环境或者机器可以试试的。
Author
Owner

@zxdong262 commented on GitHub (Jun 14, 2023):

或者试试tar.gz版本?

<!-- gh-comment-id:1590334001 --> @zxdong262 commented on GitHub (Jun 14, 2023): 或者试试tar.gz版本?
Author
Owner

@zjl369 commented on GitHub (Jun 14, 2023):

当前在公司用的公司电脑,晚上我试试家里电脑。

关于 -> Log 中有这样一段日志,其中的 token 用 * 代替了

[2023-06-14 09:52:34.603] [error] fetch error {
  message: 'unable to verify the first certificate',
  name: 'Error',
  stack: 'Error: unable to verify the first certificate\n' +
    '    at TLSSocket.onConnectSecure (node:_tls_wrap:1530:34)\n' +
    '    at TLSSocket.emit (node:events:390:28)\n' +
    '    at TLSSocket._finishInit (node:_tls_wrap:944:8)\n' +
    '    at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:725:12)',
  config: {
    transitional: {
      silentJSONParsing: true,
      forcedJSONParsing: true,
      clarifyTimeoutError: false
    },
    transformRequest: [ null ],
    transformResponse: [ null ],
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    headers: {
      Accept: 'application/vnd.github+json',
      Authorization: 'token *************************************************',
      'X-User-Agent': 'github-gist-client-js/v0.4.1',
      'User-Agent': 'axios/0.26.0'
    },
    method: 'get',
    url: 'https://api.github.com/gists?page=1&per_page=1'
  },
  code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
  status: null
}
[2023-06-14 09:52:34.605] [error] Error: unable to verify the first certificate
    at http://127.0.0.1:30974/js/electerm.js?1.25.50:2:1557262
    at Object.resolve (http://127.0.0.1:30974/js/electerm.js?1.25.50:2:1555751)
    at Worker.<anonymous> (http://127.0.0.1:30974/js/electerm.js?1.25.50:2:1556680)

这个异常使用 tar.gz 应该也无法避免吧...

不论是否使用 vpn,都会报错。

npm 使用的是淘宝镜像

C:\Users\admin>npm config get registry
https://registry.npm.taobao.org/

网上让关闭 strict-ssl 选项,npm config set strict-ssl false ,但还是失败。

<!-- gh-comment-id:1590345092 --> @zjl369 commented on GitHub (Jun 14, 2023): 当前在公司用的公司电脑,晚上我试试家里电脑。 关于 -> Log 中有这样一段日志,其中的 token 用 `*` 代替了 ``` [2023-06-14 09:52:34.603] [error] fetch error { message: 'unable to verify the first certificate', name: 'Error', stack: 'Error: unable to verify the first certificate\n' + ' at TLSSocket.onConnectSecure (node:_tls_wrap:1530:34)\n' + ' at TLSSocket.emit (node:events:390:28)\n' + ' at TLSSocket._finishInit (node:_tls_wrap:944:8)\n' + ' at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:725:12)', config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, transformRequest: [ null ], transformResponse: [ null ], timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, headers: { Accept: 'application/vnd.github+json', Authorization: 'token *************************************************', 'X-User-Agent': 'github-gist-client-js/v0.4.1', 'User-Agent': 'axios/0.26.0' }, method: 'get', url: 'https://api.github.com/gists?page=1&per_page=1' }, code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE', status: null } [2023-06-14 09:52:34.605] [error] Error: unable to verify the first certificate at http://127.0.0.1:30974/js/electerm.js?1.25.50:2:1557262 at Object.resolve (http://127.0.0.1:30974/js/electerm.js?1.25.50:2:1555751) at Worker.<anonymous> (http://127.0.0.1:30974/js/electerm.js?1.25.50:2:1556680) ``` 这个异常使用 tar.gz 应该也无法避免吧... 不论是否使用 vpn,都会报错。 npm 使用的是淘宝镜像 ``` C:\Users\admin>npm config get registry https://registry.npm.taobao.org/ ``` 网上让关闭 `strict-ssl` 选项,`npm config set strict-ssl false` ,但还是失败。
Author
Owner

@zxdong262 commented on GitHub (Jun 14, 2023):

错误信息里提到了证书,也许是本机证书问题?

<!-- gh-comment-id:1590447466 --> @zxdong262 commented on GitHub (Jun 14, 2023): 错误信息里提到了证书,也许是本机证书问题?
Author
Owner

@zjl369 commented on GitHub (Jun 14, 2023):

应该不是证书问题,之前为了同步 IDEA 配置,也弄了个 token,是可以正常使用的,图中还有最近使用时间
image

<!-- gh-comment-id:1590491773 --> @zjl369 commented on GitHub (Jun 14, 2023): 应该不是证书问题,之前为了同步 IDEA 配置,也弄了个 token,是可以正常使用的,图中还有最近使用时间 ![image](https://github.com/electerm/electerm/assets/50287763/f33b7998-de58-4cc2-8d8a-0756e84362fc)
Author
Owner

@zjl369 commented on GitHub (Jun 14, 2023):

gitee 直接就成功了 😂

Snipaste_2023-06-14_13-48-40

<!-- gh-comment-id:1590514483 --> @zjl369 commented on GitHub (Jun 14, 2023): gitee 直接就成功了 😂 ![Snipaste_2023-06-14_13-48-40](https://github.com/electerm/electerm/assets/50287763/7d2e4f84-8b55-46d1-bd42-4bc8c5148f66)
Author
Owner

@zjl369 commented on GitHub (Jun 15, 2023):

我可能知道大概怎么回事了...

https://github.com/electerm/electerm/issues/2851#issuecomment-1590345092
将以上回复里日志中的 url 和 header 拿到 postman 调用

开启 postman SSL certificate verification

  • vpn:关闭
  • postman SSL certificate verification:开启

File - Setting - General - SSL certificate verification 默认开启

出现相同的报错“Unable to verify the first certificate”
image

裸连 github 时,有时也会提示它的 443 端口访问不了,不知道是墙的问题还是最近公司网络有点儿问题。当然,连了 vpn 就可以了,比如现在

关闭 postman SSL certificate verification

  • vpn:关闭
  • postman SSL certificate verification:关闭

正常调用
image

开启 vpn

  • vpn:开启
  • postman SSL certificate verification:开启

正常调用
image

推测

  1. electerm 也做一个 ssl 证书验证开关?
  2. 我使用的 vpn 是 Clash for Windows v0.20.18,好像对 electerm 不起作用,electerm 不能被代理?还是和 Clash for Windows 冲突......
<!-- gh-comment-id:1592659519 --> @zjl369 commented on GitHub (Jun 15, 2023): 我可能知道大概怎么回事了... https://github.com/electerm/electerm/issues/2851#issuecomment-1590345092 将以上回复里日志中的 url 和 header 拿到 postman 调用 ### 开启 postman SSL certificate verification - vpn:关闭 - postman SSL certificate verification:开启 File - Setting - General - SSL certificate verification 默认开启 出现相同的报错“Unable to verify the first certificate” ![image](https://github.com/electerm/electerm/assets/50287763/b49af3a6-f652-4fdd-a10e-703a8e2e2909) 裸连 github 时,有时也会提示它的 443 端口访问不了,不知道是墙的问题还是最近公司网络有点儿问题。当然,连了 vpn 就可以了,比如现在 ### 关闭 postman SSL certificate verification - vpn:关闭 - postman SSL certificate verification:关闭 正常调用 ![image](https://github.com/electerm/electerm/assets/50287763/921bc069-8691-4b2d-9859-318bab4fc8f9) ### 开启 vpn - vpn:开启 - postman SSL certificate verification:开启 正常调用 ![image](https://github.com/electerm/electerm/assets/50287763/4e157294-d55c-4afa-8bc5-dde9a574d885) ### 推测 1. electerm 也做一个 ssl 证书验证开关? 2. 我使用的 vpn 是 [Clash for Windows v0.20.18](https://github.com/Fndroid/clash_for_windows_pkg/releases/tag/0.20.18),好像对 electerm 不起作用,electerm 不能被代理?还是和 Clash for Windows 冲突......
Author
Owner

@zjl369 commented on GitHub (Jun 15, 2023):

或者你看看这里面的方式可行吗
Unable to verify the first certificate in nodejs

<!-- gh-comment-id:1592670095 --> @zjl369 commented on GitHub (Jun 15, 2023): 或者你看看这里面的方式可行吗 [Unable to verify the first certificate in nodejs](https://zhuanlan.zhihu.com/p/108958388)
Author
Owner

@zxdong262 commented on GitHub (Jun 15, 2023):

electerm里可以设置代理服务器,然后同步就会使用代理进行,可以试试

<!-- gh-comment-id:1592674397 --> @zxdong262 commented on GitHub (Jun 15, 2023): electerm里可以设置代理服务器,然后同步就会使用代理进行,可以试试
Author
Owner

@zxdong262 commented on GitHub (Jun 15, 2023):

看起来就是github被墙的问题了

<!-- gh-comment-id:1592675746 --> @zxdong262 commented on GitHub (Jun 15, 2023): 看起来就是github被墙的问题了
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/electerm#1871
No description provided.