你如何让 api explorer oauth2 为 go-endpoints 工作?(范围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\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})
你如何使它适用于 go-endpoints?
编辑
哦!我发现这个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
相关分类