mathieudutour/medium-to-own-blog

Issue When Using Two-factor Authentication

alexfinnarn opened this issue · 4 comments

Describe the bug

I kept having issues providing my GitHub credentials even though I knew my username and password were correct. Then, it dawned on me that I should try to login via the web interface to see what happened. I forgot that I had 2FA set up. Once I disabled 2FA, I didn't have any issues.

I didn't go back to fully check that 2FA is always an issue, but right after I disabled it, my import process went smoothly.

As far as resolving this (if it is an issue), I think adding a note to the documentation makes sense.

To Reproduce
Steps to reproduce the behavior:

  1. Enable 2FA on your GitHub account.
  2. Try to run the npx command.
  3. See an authentication failure after entering the URL of the GitHub repository.

Screenshots

Screen Shot 2019-06-23 at 7 48 56 PM

Solution
If you use 2FA, you need to give a token instead of your password, that's just how GitHub works: https://help.github.com/en/articles/accessing-github-using-two-factor-authentication#using-two-factor-authentication-with-the-command-line

I think if I would have given the ssh URL then I wouldn't have been prompted?

https://github.com/mathieudutour/medium-to-own-blog/blob/master/bin/medium-to-own-blog.js#L121

possibly, it depends on your git config.

If you use 2FA, you need to give a token instead of your password, that's just how GitHub works: https://help.github.com/en/articles/accessing-github-using-two-factor-authentication#using-two-factor-authentication-with-the-command-line

Alright. I'm not sure that this info would be helpful in documentation or on the prompts since the user's git config can vary widely, but maybe it can be worked into text for certain kinds of errors?

If not, then feel free to close the issue. Someone who is having issues authenticating will at least see the closed issue, if they do their homework.

I made a PR along with #56 to add this to the readme under troubleshooting. Do with that what you will and if not merge in, then I think you can close the issue as I'm not sure what else to put in the codebase around this.