I have some code I have used in the past to count student commits on GitHub (see this blogpost), which worked as of a few months ago. However, in the interim I have enabled two-factor authentication on GitHub. So I'm now running into an issue when I attempt to use rvest to log in to GitHub. Does anyone have demo code of how to get around this? I suspect it is something like
although I get an error running this, perhaps because I haven't pre-specified the URL where the login will bring you? If anyone has an example of using rvest with two-factor authentication, please let me know!
In case anyone runs across this, I was able to solve my issue. The main problem with my code above is I thought the box to enter the second factor number was labeled authenticity_token when really it should be otp. This code works:
Of course, you need to substitute in YourGitHubUsername and SuperSecureP@ssw0rd, as well as the 2FANUMBERS (make sure to watch the app and start right at the top of a 30-second period to give yourself the most time!). Thanks to this post from Petr Bouchal for giving me the confidence that I could submit more than one form in a session!