Skip to content

Add support for two-factor authentication#13

Open
careyrp wants to merge 1 commit intoxiongchiamiov:masterfrom
careyrp:dev-2fa
Open

Add support for two-factor authentication#13
careyrp wants to merge 1 commit intoxiongchiamiov:masterfrom
careyrp:dev-2fa

Conversation

@careyrp
Copy link
Copy Markdown

@careyrp careyrp commented Sep 10, 2018

Add support for two factor authentication.

Register a callback function to handle two factor authentication requests.

In the callback, generate a command line prompt for a 2FA key.

@edouard-lopez
Copy link
Copy Markdown

Still got the 2FA error message

env ❯ python2 github-pr-stats --basic my-user https://github.com/org/repo/
Username: my-user
Password:
Enter 2FA code: 366716
Traceback (most recent call last):
  File "github-pr-stats", line 123, in <module>
    url=githubUrl)
  File "github-pr-stats", line 86, in authorize
    return gh.authorize(login, password, scopes, note, note_url, client_id, client_secret)
  File "/home/ed8/.local/lib/python2.7/site-packages/github3/github.py", line 114, in authorize
    json = self._json(self._post(url, data=data), 201)
  File "/home/ed8/.local/lib/python2.7/site-packages/github3/models.py", line 86, in _json
    if self._boolean(response, status_code, 404) and response.content:
  File "/home/ed8/.local/lib/python2.7/site-packages/github3/models.py", line 107, in _boolean
    raise GitHubError(response)
github3.models.GitHubError: 401 Must specify two-factor authentication OTP code.

@careyrp

This comment has been minimized.

@careyrp
Copy link
Copy Markdown
Author

careyrp commented Jul 5, 2019

The version of github.py is out of date. Need to upgrade to github.py 1.2.0.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants