defunkt / gist.el

Yet another Emacs paste mode, this one for Gist.
550 stars 90 forks source link

gist.el doesn't work with 2 factor Auth #113

Open jjasghar opened 6 years ago

jjasghar commented 6 years ago

One of my organizations forced 2 factor Auth on me, and now trying to run M-x gist-buffer-private I get this:

Contacting host: api.github.com:443
Opening TLS connection to ‘api.github.com’...
Opening TLS connection with ‘gnutls-cli --x509cafile nil -p 443 api.github.com’...failed
Opening TLS connection with ‘gnutls-cli --x509cafile nil -p 443 api.github.com --protocols ssl3’...failed
Opening TLS connection with ‘openssl s_client -connect api.github.com:443 -no_ssl2 -ign_eof’...done
Opening TLS connection to ‘api.github.com’...done
Decrypting /Users/jjasghar/.authinfo.gpg...done
json-read: JSON readtable error

I'm not sure how to debug this farther, but this is the only change that has happened between Github and my Emacs installation recently.

zzamboni commented 6 years ago

I was able to use gist.el with 2FA enabled by creating a Personal Access Token with "gist" scope, and using it instead of my password, and also when gist.el asks for your "OAuth Token".

Documentation on how to create the token: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/

You may need to remove the [github] section from your ~/.gitconfig file, and restart Emacs so that gist.el asks for your information again.

chrismoos commented 6 years ago

@jjasghar I ran into what looked like a similar issue, but it turned out to be an issue with the openssl binary on my machine not supporting TLSv1.2 (GitHub doesn't support old TLS protocols anymore).

If you have a Mac, make sure you have the latest openssl installed via Homebrew (brew upgrade openssl) and get the binary on your path:

ln -s /usr/local/opt/openssl/bin/openssl /usr/local/bin/openssl

Then exit emacs, open a new terminal, and try again.

nickanderson commented 3 years ago

I was able to use gist.el with 2FA enabled by creating a Personal Access Token with "gist" scope, and using it instead of my password, and also when gist.el asks for your "OAuth Token".

Documentation on how to create the token: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/

You may need to remove the [github] section from your ~/.gitconfig file, and restart Emacs so that gist.el asks for your information again.

Yeah, it's disappointing that I can't seem to leverage authinfo which can be gpg encrypted and where I store other credentials used by forge and magit. I don't want to put a token into my .gitconfig which is plain text.