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

Support for Oauth in API #3033

Open
raphink opened this issue Apr 28, 2016 · 5 comments
Open

Support for Oauth in API #3033

raphink opened this issue Apr 28, 2016 · 5 comments
Labels
⛔ do not send pull request Don't ever think about it! 🎯 feature Categorizes as related to a new feature priority: low Open source project is supported at the best effort

Comments

@raphink
Copy link

raphink commented Apr 28, 2016

Authentication tokens cannot be passed using standard OAuth2.

The following code returns a 401 HTTP error, but passes by adding ?token=<mytoken> to the URL:

package main

import ( 
  "fmt"
  "golang.org/x/oauth2"
)

func main() { 
  ts := oauth2.StaticTokenSource(
    &oauth2.Token{AccessToken: "<mytoken>"},
  ) 
  tc := oauth2.NewClient(oauth2.NoContext, ts)

  a, _ := tc.Get("http://localhost:3000/api/v1/repos/<user>/<repo>/issues")
  fmt.Printf("%v", a)
}
@raphink
Copy link
Author

raphink commented Apr 28, 2016

If this was supported, then https://github.com/google/go-github would work with gogs by just overriding the BaseURL property of a client.

@bkcsoft
Copy link
Contributor

bkcsoft commented May 2, 2016

Gogs had OAuth-support a while back but was removed since no-one wanted to maintain it.

And no, google/go-github wouldn't work since Gogs has a slightly different json-schema 😞

@unknwon unknwon added 🎯 feature Categorizes as related to a new feature priority: low Open source project is supported at the best effort ⛔ do not send pull request Don't ever think about it! labels Jul 2, 2016
@JohnTheodore
Copy link

JohnTheodore commented Apr 22, 2017

@bkcsoft is there a link to the old commit for oauth2 that was working? there might be some someone interested in looking at or maintaining oauth2. I want to point them to the right resources.

also @unknwon what was wrong with the previous oauth2 implementation? what mistakes would a new maintainer have to avoid to get oauth2 added?

@stevegt
Copy link

stevegt commented May 10, 2017

Anyone looking for this feature may benefit from reading these two issues:
#1304
go-gitea/gitea#26

@JohnTheodore
Copy link

JohnTheodore commented May 10, 2017

@stevegt thanks for the comment! go-gitea has login/authn oauth2, and commit status apis just merged. I think once you can generate scoped oauth2 tokens that can have read only access to the repo and update commit status, go-gitea would integrate with drone in a similar way that drone integrates with github or bitbucket. exciting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⛔ do not send pull request Don't ever think about it! 🎯 feature Categorizes as related to a new feature priority: low Open source project is supported at the best effort
Projects
None yet
Development

No branches or pull requests

5 participants