How do you make the api explorer oauth2 work for go-endpoints? (scope https://www.googleapis.com/auth/userinfo.email )
func (gs *GreetingService) Store(r *http.Request, req *Request, resp *Response) error {
c := appengine.NewContext(r)
u := user.Current(c)
if u != nil {c.Infof("Hello, %v
", u)}
if u != nil {fmt.Printf("Hello, %v
", u)}
}
u
is always nil, in java I had to add something like this to make it work.
@Api(name = "rest1",
version = "0",
scopes = {Id.EMAIL_SCOPE},
clientIds = {Id.WEB_CLIENT_ID, Id.ANDROID_CLIENT_IDd, Id.ANDROID_CLIENT_IDr, Id.EXPLORER_ID},
audiences = {Id.ANDROID_AUDIENCE})
How do you make it work for go-endpoints?
EDIT
doh! I found this http://godoc.org/github.com/crhym3/go-endpoints/endpoints#CurrentBearerTokenUser PS what is the API_EXPLORER_CLIENT_ID for golang?
doh2! http://godoc.org/github.com/crhym3/go-endpoints/endpoints#pkg-constants