Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tasks defined in GitReleaseManager.cake do not support 2FA #452

Closed
Jericho opened this issue Sep 28, 2019 · 4 comments · Fixed by #453
Closed

Tasks defined in GitReleaseManager.cake do not support 2FA #452

Jericho opened this issue Sep 28, 2019 · 4 comments · Fixed by #453
Assignees
Milestone

Comments

@Jericho
Copy link
Member

Jericho commented Sep 28, 2019

I recently enabled 2FA on my GitHub account and I can no longer execute .\build -t releasenotes. I get the following exception: Octokit.TwoFactorRequiredException: Must specify two-factor authentication OTP code.

@Jericho Jericho self-assigned this Sep 28, 2019
@gep13
Copy link
Member

gep13 commented Sep 28, 2019

@Jericho yes, this makes sense. When using GitReleaseManager (and therefore Octokit) when also using 2FA, the recommendation is to use a Personal Access Token, rather than your actual password. When doing this, the 2FA will not be triggered, and it will work correctly.

Although the wording of the variables in Cake.Recipe suggest that it is a Password that is required, you can actually also pass a Token in as the parameter. This is what I do, and it works fine.

@gep13
Copy link
Member

gep13 commented Sep 28, 2019

GitReleaseManager itself was recently updated to indicate that both a username/password, or a token can be used. Perhaps Cake.Recipe should be updated to reflect this as well.

@Jericho
Copy link
Member Author

Jericho commented Sep 28, 2019

I didn't realize that I could use my token in lieu of my password but I do know that there is an overload for the GitReleaseManagerCreate method where you can specify your token so I was going to edit the task to look like this (this is pseudo-code of the top of my head):

if (!string.IsNullOrEmpty(BuildParameters.GitHub.Token))    // Token would be a new parameter
{
    GitReleaseManagerCreate(BuildParameters.GitHub.Token, BuildParameters.GitHub.UserName, blablabla);
}
else
{
    GitReleaseManagerCreate(BuildParameters.GitHub.UserName, BuildParameters.GitHub.Password, blablabla);
}

@gep13
Copy link
Member

gep13 commented Sep 28, 2019

Yip, I think that makes a lot of sense, and certainly makes things a lot clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants