2
如何讓api explorer oauth2爲go-endpoints工作? (範圍https://www.googleapis.com/auth/userinfo.email)go-endpoints oauth2用戶始終爲零
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\n", u)}
if u != nil {fmt.Printf("Hello, %v\n", u)}
}
u
始終是零,在java中我不得不添加這樣的事情,使其工作。
@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})
你如何使它成爲端點?
編輯
doh!我發現這個http://godoc.org/github.com/crhym3/go-endpoints/endpoints#CurrentBearerTokenUser PS什麼是golang的API_EXPLORER_CLIENT_ID?
doh2! http://godoc.org/github.com/crhym3/go-endpoints/endpoints#pkg-constants