gists icon indicating copy to clipboard operation
gists copied to clipboard

The library has support for accounts with two-factor auth?

Open metcoder95 opened this issue 5 years ago • 4 comments

Recently I become to experiment with the library for some project that I'm currently working, somehow when I use my GitHub account to do some tests I saw that an error comes and was from the two-factor auth (my GitHub account has the two-factor auth).

metcoder95 avatar Oct 29 '18 18:10 metcoder95

Try using a personal access token (you can create one by following this GitHub article).

Then use token on the options instead of username/password:

const gists = new Gists({ token: 'XXXXXXXXXXXXXX' });

Since the linked article specifically shows command line usage, you might be able to use the token as your password like this:

const gists = new Gists({
  username: 'doowb',
  password: 'XXXXXXXXXXXXX' // token
});

If you get it working, please let me know so I can update the documentation.

doowb avatar Oct 29 '18 18:10 doowb

Thanks! It works perfectly!

Using the token option in the Gist constructor works correctly. Instead, using it as a password threw a Bad credentials error.

metcoder95 avatar Oct 30 '18 18:10 metcoder95

Thanks for letting me know. I'll get the docs updated soon.

doowb avatar Oct 30 '18 19:10 doowb

Hi, again!

I'm currently working with the edit method to update a single gist. Using the token method to auth throws an error: Error: Not Found. I think it's because using a token don't let you update a gist but in the GitHub API docs, doesn't say something about it.

Any idea?

metcoder95 avatar Nov 14 '18 19:11 metcoder95