首页 > 解决方案 > 您的令牌没有被授予在 GitHub 上为“read:org”执行此查询错误所需的范围

问题描述

我正在使用 GraphQL 查询 GitHub,但收到此错误:

The 'name' field requires one of the following scopes: ['read:org'], but your token has only been granted the: ['repo'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens.

标签: githubgraphqltoken

解决方案


生成并使用具有足够访问权限的密钥

  • Step 1 在github中,选择你需要的范围
  • 步骤 2 生成新令牌
  • 第 3 步 在您的应用程序中使用该令牌(通过 env 变量强烈推荐)。
  • 第 4 步可能需要重新启动应用程序。

请参阅下面的屏幕截图。我的完整密钥显然没有显示。

github导航有点棘手,目前是:

A点击“开发者设置”

在此处输入图像描述

B点击“个人访问令牌”

在此处输入图像描述

C点击“生成令牌”

在此处输入图像描述

令牌设置:

在此处输入图像描述

在此处输入图像描述


推荐阅读