Skip to content

Commit 26d54be

Browse files
committed
Issue a dump request to trigger 2FA SMS
1 parent e2c02fa commit 26d54be

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

github/client.go

+5
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,11 @@ func (client *Client) FindOrCreateToken(user, password, twoFactorCode string) (t
263263
c := octokit.NewClientWith(client.apiEndpoint(), nil, basicAuth)
264264
authsService := c.Authorizations(client.requestURL(url))
265265

266+
if twoFactorCode != "" {
267+
// dummy request to trigger a 2FA SMS since a HTTP GET won't do it
268+
authsService.Create(nil)
269+
}
270+
266271
auths, result := authsService.All()
267272
if result.HasError() {
268273
err = &ClientError{result.Err}

0 commit comments

Comments
 (0)