-
Notifications
You must be signed in to change notification settings - Fork 47
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
Add profile getter #2
Comments
What is a "profile getter" ? |
+1 Or at least some sort of hook we could use once the oauth handshake is completed so that we could do this ourselves...? |
I added this (probably somewhat ugly) hack to test this functionality and worked fine with Google atleast. type Requests interface {
Get(url string) []byte
}
type request struct {
token
}
func (r *request) Get(url string) []byte {
transport := &oauth.Transport{}
transport.Token = &oauth.Token{r.AccessToken, r.RefreshToken, r.Expiry, r.Extra}
resp, _ := transport.Client().Get(url)
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
return body
} resp := request.Get("https://www.googleapis.com/plus/v1/people/me")
json.Unmarshal(resp, &profile) in my function (with Any comments on this method? Just returning the http.Client() would probably be better so people could easily add headers and POST, PUT, DELETE and whatever they might need. This was just a quick hack to test the idea. |
Authentication (who is the user) and authorisation (what am I allowed to do, which is the scope of the OAuth 2.0 standard) are pretty different things. There isn't really anything called a OAuth2 profile and the data model of the profile on each different API (and scope) is pretty different. Maybe it would help if we could define what was meant with a profile getter? What exact information from each service is it meant to retrieve? Simpe userID stuff or something a bit more complete? A full-fledged profile getter might be better served as a separate handler that depends on this one. |
This shouldn't be in OAuth2 library logic. |
No description provided.
The text was updated successfully, but these errors were encountered: