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

Add profile getter #2

Open
rakyll opened this issue Feb 11, 2014 · 5 comments
Open

Add profile getter #2

rakyll opened this issue Feb 11, 2014 · 5 comments

Comments

@rakyll
Copy link
Contributor

rakyll commented Feb 11, 2014

No description provided.

@jaredgisin
Copy link
Contributor

What is a "profile getter" ?

@seedifferently
Copy link

+1

Or at least some sort of hook we could use once the oauth handshake is completed so that we could do this ourselves...?

@hansrodtang
Copy link

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 request oauth2.Requests via the injector)

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.

@hansrodtang
Copy link

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.

@ahmetb
Copy link
Contributor

ahmetb commented Jul 20, 2014

This shouldn't be in OAuth2 library logic.

@rakyll rakyll closed this as completed Jul 21, 2014
@rakyll rakyll reopened this Jul 21, 2014
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

5 participants