Skip to content

No CTA after mistaken deletion of oauth access #627

Description

@rajeevdesai

Describe the feature or problem you’d like to solve

After revoking access from github.com/settings/applications, when I try to run any command, it errors out to http error, 'https://api.github.com/graphql' failed (401): 'Bad credentials'. It should instead identify this error and redirect to authentication.

Proposed solution

This is useful in cases of mistaken deletion of oauth access. User should be shown a CTA in this case, like authentication.

Another solution is to add an authentication command

Activity

  1. mislav commented on Mar 10, 2020

    @mislav
    Contributor

    Thank you for reporting! I definitely agree that an expired/invalidated OAuth token should prompt you to re-authenticate instead of just failing with an error like this.

    In the meantime, you can force re-authentication by deleting ~/.config/gh/config.yml

  2. added
    bugSomething isn't working
    priority-3Affects a small number of users or is largely cosmetic
    and removed
    enhancementa request to improve CLI
    on Mar 17, 2020
  3. mislav commented on Mar 17, 2020

    @mislav
    Contributor

    Re-classified this as "bug" since the error message is not descriptive of what is happening and doesn't provide any clue to the user about how they might fix it.

  4. alex-frankel commented on Jun 5, 2020

    @alex-frankel

    @mislav - it looks like the mitigation for forcing re-auth is specific to linux. What is the equivalent for windows?

  5. mislav commented on Jun 8, 2020

    @mislav
    Contributor

    What is the equivalent for windows?

    It's the same. You just need to find .config/gh/config.yml in your home directory

  6. alex-frankel commented on Jun 8, 2020

    @alex-frankel

    Ah found it in %USERPROFILE%\.config - thanks

  7. StephenBrown2 commented on Jun 12, 2020

    @StephenBrown2

    I am receiving this error for every command I try after updating to gh 0.10.0 running on a Mac.

    ❯ gh version
    gh version 0.10.0 (2020-06-11)
    https://github.com/cli/cli/releases/tag/v0.10.0
    

    I've deleted the entire config directory and gotten a new oauth token out of it, with the new split config, thinking that might fix it.

    This happens on any repo, mine or others, and the message seems like it's not able to read from the new hosts.yml?

    EDIT: Not sure what changed, but things are working now. Carry on.

  8. nikoheikkila commented on Jun 15, 2020

    @nikoheikkila

    Having the same issue as @StephenBrown2 had, but mine hasn't fixed itself. Removing the configuration directory didn't force reauthentication.

    $ gh version
    gh version 0.10.0 (2020-06-11)
    https://github.com/cli/cli/releases/tag/v0.10.0
    
    $ gh pr list
    http error, 'https://api.github.com/graphql' failed (401): 'Bad credentials
  9. mislav commented on Jun 15, 2020

    @mislav
    Contributor

    @nikoheikkila Do you have GITHUB_TOKEN set in your environment by any chance?

    If that is cleared, and ~/.config/gh does not exist, re-authentication will definitely trigger.

  10. nikoheikkila commented on Jun 16, 2020

    @nikoheikkila

    @nikoheikkila Do you have GITHUB_TOKEN set in your environment by any chance?

    If that is cleared, and ~/.config/gh does not exist, re-authentication will definitely trigger.

    Thanks! Having deleted the GITHUB_TOKEN I was able to authenticate again. Yeah, could have a proper CTA here as suggested in this thread.

  11. whoopsmith commented on Jun 16, 2020

    @whoopsmith

    I had the the same problem. But I can't seem to get re-authenticated.

    Deleted .config/gh

    gh pr list 
    Notice: authentication required
    Press Enter to open github.com in your browser... 
    

    But then my browser opens to this page and I'm stuck

    https://github.com/settings/emails

  12. mislav commented on Jun 16, 2020

    @mislav
    Contributor

    @whoopsmith I think that means that you first need to confirm your primary email over the web interface before you can use GitHub CLI (and most other features in your account).

  13. whoopsmith commented on Jun 16, 2020

    @whoopsmith

    @whoopsmith I think that means that you first need to confirm your primary email over the web interface before you can use GitHub CLI (and most other features in your account).

    My email is listed as primary and AFAICT is confirmed. This is my active work account. If its not confirmed I don't see any sort of option to restart the process.

  14. mislav commented on Jun 16, 2020

    @mislav
    Contributor

    @whoopsmith I'm sorry, then I have no idea why you got redirected to https://github.com/settings/emails. CLI doesn't ever open that page as part of OAuth flow. Since it might be a symptom of a deeper issue, maybe you should write to [email protected]

  15. whoopsmith commented on Jun 16, 2020

    @whoopsmith

    @whoopsmith I'm sorry, then I have no idea why you got redirected to https://github.com/settings/emails. CLI doesn't ever open that page as part of OAuth flow. Since it might be a symptom of a deeper issue, maybe you should write to [email protected]

    Interesting. ok Thanks. Its very strange. It was working at some point before the upgrade (version .6) but I haven't used it in a while and I didn't check it right before the upgrade.

    Can I go create a auth via https://github.com/settings/developers and then manually add that to the config file?

  16. vilmibm commented on Aug 13, 2020

    @vilmibm
    Contributor

    Given that gh auth status and supporting auth commands are in trunk, I'm going to close this.

  17. vilmibm commented on Aug 14, 2020

    @vilmibm
    Contributor

    @mislav pointed out this wasn't fully covered by the auth commands themselves, so I'll ensure that there are sufficient CTAs in the course of doing #1511

  18. bigbite95110 commented on Aug 14, 2020

    @bigbite95110
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority-3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions