简体   繁体   English

是否可以使用 GitHub api 为启用了 2FA 而无需访问 UI 的服务帐户创建访问令牌?

[英]Is it possible to create an access token using GitHub api for a service account with 2FA enabled without access to UI?

I have a service account that I need to use to access GitHub.我有一个服务帐户,我需要使用它来访问 GitHub。
This service account has two-factor authentication enabled.此服务帐户启用了双重身份验证。

I do not have access to the UI.我无权访问 UI。
I do have the password for that service account.我确实有该服务帐户的密码。

I need to create a personal access token and to accept transfer of a GitHub app to this service account.我需要创建个人访问令牌并接受将 GitHub 应用程序转移到此服务帐户。
Is this possible using the GitHub API v4?这可以使用 GitHub API v4 吗?

There is a feature request pending using the official GitHub CLI gh使用官方GitHub CLI gh有一个待处理的功能请求

Create/Revoke Personal Access Tokens #2531创建/撤销个人访问令牌 #2531

Proposed solution建议的解决方案

Calling gh token create will create a new token and output the token value Calling gh token revoke will revoke the token passed in调用gh token create会创建一个新的token并输出token值调用gh token revoke会撤销传入的token

But there is no obvious existing API to create/revoke a PAT, only SSH keys , which could be a workaround, if you can use SSH URLS: the PAT is only needed for HTTPS URLs.但是没有明显的现有 API可以创建/撤销 PAT,只有SSH 密钥,如果您可以使用 SSH URL,这可能是一种解决方法:只有 HTTPS URL 需要 PAT。

However, for checking an OAuth App token , you do need indeed a token.但是,要检查 OAuth App 令牌,您确实需要一个令牌。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM