Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth authentication error #86

Closed
PatentInsights opened this issue Jul 4, 2022 · 5 comments
Closed

Auth authentication error #86

PatentInsights opened this issue Jul 4, 2022 · 5 comments
Assignees
Labels

Comments

@PatentInsights
Copy link

I have an issue very similar to OAuth authenitication error #83. I have created a Personal Access Token in GIT, ticking the box for writing gists, and saved this using the line of text - Sys.setenv(GITHUB_PAT = "ghpblahblah") - where "ghpblahblah" was the token generated, which starts with "ghp". I can see in RStudio (Sys.getenv()) that the token is "ghpblahblahblah", as it should be.

However I run the command get("auth_config", envir=gistr:::cache)$auth_token$credentials$access_token, I end up with another token, beginning with "gho" this time, and the error message.

I note that when I run the command gist_auth(), I do not get a new browser tab opening asking me to verify my authentication.

More to the point, when I try to write a new gist

gist_create(public=FALSE, browse=FALSE, filename="test.txt", code="test")

I end up with the following error message:

GitHub response headers suggest no or insufficient scopes
To create gists you need the gist OAuth scope on your token.

What I am doing wrong?

Session Info
gist_create(public=FALSE, browse=FALSE, filename="test.txt", code="test")
@ScientificProgrammer
Copy link
Contributor

Hi @PatentInsights:

Currently, I am weighing implementing the httr2 package which should make oauth authentication simpler and more robust than it is currently. I have just assumed responsibility for maintaining the gistr package, so I'm still trying to figure out where best to start. I will follow up ASAP.

@PatentInsights
Copy link
Author

PatentInsights commented Aug 2, 2022 via email

@ScientificProgrammer
Copy link
Contributor

Hi Mike,

Thanks for closing the loop on this issue. I'll go ahead and close the issue. However, before I do, if you want to share any insights with me, such as suggestions for how best to update the documentation for the current implementation, I'm very interested in your input.

I'm still studying the package's current implementation, which also includes trying to decide how much emphasis I should place on coding enhancements versus updating the documentation. Your specific issue appears to be a great candidate for the latter.

Perhaps, like most software developers, I prefer writing code much more than writing documentation. However, I'm forcing myself to be more disciplined in striking this balance.

@PatentInsights
Copy link
Author

PatentInsights commented Aug 9, 2022 via email

@ScientificProgrammer
Copy link
Contributor

That's very helpful. I've made a similar mistake countless times, and from a software side, it's fairly easy to check permissions, then give more descriptive feedback when something fails. For now, I'll put a note in the documentation, but I'll also look into the current code to see how it works. If I'm unable to easily perform a more automated diagnostic for permissions, perhaps by returning a more descriptive error message, such as a suggestion that the user check their PAT permissions and confirm that it has the appropriate gist permissions, it'll save future users some time. Thanks again for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants