Skip to content

Commit

Permalink
Issue a dummy request to trigger 2FA SMS
Browse files Browse the repository at this point in the history
See related discussion mislav/hub#543
  • Loading branch information
owenthereal committed Apr 20, 2014
1 parent e2c02fa commit 24f4224
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions github/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ func (client *Client) FindOrCreateToken(user, password, twoFactorCode string) (t
c := octokit.NewClientWith(client.apiEndpoint(), nil, basicAuth)
authsService := c.Authorizations(client.requestURL(url))

if twoFactorCode != "" {
// dummy request to trigger a 2FA SMS since a HTTP GET won't do it
authsService.Create(nil)
}

auths, result := authsService.All()
if result.HasError() {
err = &ClientError{result.Err}
Expand Down

0 comments on commit 24f4224

Please sign in to comment.