当composer连接到GitHub时,我会收到有关弃用身份验证方法的警告。我应该使用什么身份验证配置? [英] When composer connects to GitHub I receive a warning about a deprecation authentication method. What authentication configuration should I use?

查看:169
本文介绍了当composer连接到GitHub时,我会收到有关弃用身份验证方法的警告。我应该使用什么身份验证配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GitHub已开始发送有关不赞成使用的身份验证的电子邮件,但是我还没有找到详细说明在新体制下作曲者的 auth.json 的外观的资源。

GitHub has started sending emails about deprecated authentication but I have not yet found a resource for detailing what composer's auth.json should look like under the new regime.

我的要求相对简单-使用作曲家更新开发中的Symfony应用程序,并偶尔尝试使用其他存储库。

My requirements are relatively simple - using composer to update a Symfony application in development and occasionally experimenting with other repos.

有了这个,我的原始配置(自动生成)...

With this, my original configuration (automatically built)...

{
    "github-oauth": {
        "github.com": "(a string)"
    }
}

...我收到此警告:

... I receive this warning:


。 ..您的个人访问令牌...被用作查询参数
的一部分,以通过GitHub API访问端点...请改用
Authorization HTTP标头...

...your personal access token...was used as part of a query parameter to access an endpoint through the GitHub API...Please use the Authorization HTTP header instead...

但是当我尝试使用这种其他配置时:

But when I try with this other configuration:

{
    "http-basic": {
        "github.com": {
            "username": " my email address",
            "password": " my password "
        }    }
}

我收到此其他警告:


您最近使用密码使用Composer / 1.9.1通过GitHub
API访问端点...我们建议使用一个人

它应该是什么样子?为什么我会收到这些弃用警告?

What should it really look like and why am I getting these deprecation warnings?

推荐答案

在这两种配置中,第一种是正确的。

Of these two configurations, the first is the correct one.

字符串应该是您的个人访问令牌(PAT),使用在GitHub上适当的访问范围

The "string" should be your Personal Access Token (PAT), configured with the appropriate access scopes on GitHub.

为令牌配置范围您需要访问GitHub开发人员设置-> 个人访问令牌

To configure the scopes for your token you need to visit your GitHub Developer Settings -> Personal Access Tokens.

第二种格式尝试验证发送您的用户名和密码,而不是生成的令牌。这是不良的安全习惯,因此不应该这样做。

The second format attempts to authenticate sending your username and password instead of a generated token. That's a bad security practice, and should not be done.

但是收到第一个警告的主要原因是因为您正在运行旧的作曲家版本

But the main reason you are getting the first warning is because you are running an old composer version.

您需要更新到1.9.3版本在此位置已解决。在早期版本中,由于composer如何连接到GitHub,您可能会收到弃用警告。

You need to update to the 1.9.3 version, where this was fixed. On previous versions you may get the deprecation warning nonetheless because of how composer connects to GitHub.

这篇关于当composer连接到GitHub时,我会收到有关弃用身份验证方法的警告。我应该使用什么身份验证配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆