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

Implement a user-ready authentication workflow #4

Closed
vermiculus opened this issue Feb 23, 2017 · 3 comments
Closed

Implement a user-ready authentication workflow #4

vermiculus opened this issue Feb 23, 2017 · 3 comments
Assignees

Comments

@vermiculus
Copy link
Contributor

The authentication workflow is something gh.el seems to do very, very well. I like the idea of using existing authentication configuration options, but it would be worthwhile creating an interactive workflow that will guide the user through this configuration when we run into #2.

Since it's not wrapping any resources, this seems to be in-scope for ghub.

vermiculus added a commit to vermiculus/ghub that referenced this issue Mar 4, 2017
vermiculus added a commit to vermiculus/ghub that referenced this issue Mar 4, 2017
vermiculus added a commit to vermiculus/ghub that referenced this issue Mar 4, 2017
vermiculus added a commit to vermiculus/ghub that referenced this issue Mar 4, 2017
@vermiculus
Copy link
Contributor Author

vermiculus commented Mar 5, 2017

On second thought, it would probably be in the better spirit of ghub (and glab) to only offer the authentication options as opposed to the actual workflow. At least, that's what I've implemented here.

A possible workflow implementation might be as follows:

(defun ghub-authenticate (domain scopes note)
  "Authenticates on DOMAIN with SCOPES using NOTE."
  (unless (ghub--domain-configuration domain :secure)
    (user-error "Refusing to send password over unsafe connection; configure your token in `auth-sources'"))
  (let ((ghub-force-basic-authentication t)
        (ghub-domain domain)
        (user-real-login-name
         (ghub--domain-configuration domain :username)))
    (ghub-post "/authorizations" nil
               `((scopes . ,scopes)
                 (note . ,note)))))

…which reminds me, ghub--domain-configuration should probably be public…

@tarsius tarsius self-assigned this Apr 22, 2017
@tarsius
Copy link
Member

tarsius commented Apr 26, 2017

I have merged an alternative implementation. Could you please redo ghub-authenticate on top of that and open a new issue. Thanks!

@vermiculus
Copy link
Contributor Author

Done 👍

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

No branches or pull requests

2 participants