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

Feat: allow github OAuth #17

Closed
marceloavf opened this issue Feb 21, 2018 · 7 comments
Closed

Feat: allow github OAuth #17

marceloavf opened this issue Feb 21, 2018 · 7 comments
Labels
help wanted Extra attention is needed ⭐ enhancement ⭐ New feature or request
Milestone

Comments

@marceloavf
Copy link
Owner

marceloavf commented Feb 21, 2018

Allow integration with OAuth authentication, not just Personal Access Token.

  • Return message about endpoint with token
  • Add to documentation the related issue as known issues or/and how connection should be
✅ Accept: scheme: 'PersonalAccessToken' 
✅ Accept: scheme: 'OAuth' 

Endpoint:

Basic return

{
  parameters: 
     {
        accessToken: '********'
      },
  scheme: 'PersonalAccessToken'
}

Error reference:

Case 1

Error: missing required options: token

Case 2

Error status: 401  response body:{"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}

References:
Code 1
Code 2
Code 3

Related to #16

@marceloavf marceloavf added bug 🐛 Something isn't working docs 📄 Some docs need to change labels Feb 21, 2018
@marceloavf marceloavf changed the title Fix github OAuth error Fix github OAuth/token error Feb 22, 2018
@clairernovotny
Copy link

clairernovotny commented Jun 22, 2018

Is it possible to use an OAuth token instead of returning an error? What's the issue?

@marceloavf
Copy link
Owner Author

marceloavf commented Jun 22, 2018

@onovotny, the library publish-release that's used to do all comunication with GitHub API require a token to authenticate it, I would have to investigate what OAuth token return and send it to publish-release instead of the normal token in the code below.

PRs are welcome! 🙌

const githubEndpointToken = tl.getEndpointAuthorization(githubEndpoint)
.parameters.accessToken

https://github.com/remixz/publish-release/blob/master/index.js#L76

@clairernovotny
Copy link

clairernovotny commented Jun 22, 2018

I believe that it's as "easy" as changing line 76 there from 'Authorization': 'token ' + opts.token, to 'Authorization': 'Bearer ' + opts.token,,

Plus whatever overload/config it'd need to support both methods. Like PAT, it's just another type of Authorization header.

You don't have to get your own token, you'd use the GitHub endpoint authorization endpoint for that. VSTS would have already taken care of getting the bearer token. There may be a parameter on the endpoint authorization that shows the type, in addition to AccessToken

@marceloavf
Copy link
Owner Author

I didn't notice that @onovotny, thanks for the details, so Bearer can support both parameters?

I'll try to dig the documentation of EndpointAuthorization to see if it return more parameters, but I think it returns in other prop as you can see in #16

@marceloavf marceloavf added ⭐ enhancement ⭐ New feature or request help wanted Extra attention is needed and removed bug 🐛 Something isn't working docs 📄 Some docs need to change labels Jul 3, 2018
@marceloavf marceloavf changed the title Fix github OAuth/token error Feat: allow github OAuth Jul 3, 2018
@tomkerkhove
Copy link
Contributor

Would like this as well 👍

@marceloavf
Copy link
Owner Author

Working on it @tomkerkhove ✋ , meanwhile you can use token authentication!

@marceloavf marceloavf added this to the v0.5.0 milestone Jul 8, 2018
marceloavf added a commit that referenced this issue Jul 9, 2018
@marceloavf marceloavf mentioned this issue Jul 9, 2018
marceloavf added a commit that referenced this issue Jul 9, 2018
<a name="0.5.0"></a>
# [0.5.0](v0.4.1...v0.5.0) (2018-07-09)

### Features

* allow GitHub OAuth scheme authentication ([893215d](893215d)), closes [#17](#17)
@tomkerkhove
Copy link
Contributor

Tested and verified ✔️ Thanks @marceloavf 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed ⭐ enhancement ⭐ New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants