英文:
Where can I get a token for in app billing v3 api on appengine or android?
问题
阅读文档后,我对如何从Android或App Engine端点服务器获取令牌感到不清楚。我猜他们所说的令牌是指OAuth2访问令牌?
> https://developers.google.com/android-publisher/v1_1/
> http://developer.android.com/google/play/billing/gp-purchase-status-api.html
我已经设置了一个客户端ID,如下所示:
在JavaScript中,我可以获取访问令牌gapi.auth.getToken().access_token
。但是这是同一个令牌吗?我需要什么范围?在控制台中是否需要激活某个API?
在App Engine中,我只知道如何从用户那里获取电子邮件。
var clientids = []string{WEB_CLIENT_ID, ANDROID_CLIENT_ID_d, ANDROID_CLIENT_ID_r, endpoints.ApiExplorerClientId}
var audiences = []string{WEB_CLIENT_ID}
var google_scopes = []string{"https://www.googleapis.com/auth/userinfo.email"}
func (s *Service) Google(r *http.Request, req *NoRequest, resp *User) error {
c := endpoints.NewContext(r)
g, err := endpoints.CurrentUser(c, google_scopes, audiences, clientids);
if err != nil {return err}
resp.Email=g.String()
return nil
}
你能提供关于我必须使用的令牌来验证购买(in-app-billing v3)的更多信息吗?
英文:
Reading the documentation it is unclear to me how to get a token from either android or appengine endpoint server? I assume they mean by token a oauth2 access token?
> https://developers.google.com/android-publisher/v1_1/
> http://developer.android.com/google/play/billing/gp-purchase-status-api.html
I did setup a client id like this
In javascript I can get a access token gapi.auth.getToken().access_token
. But is it the same token? What scope do I need? Is there a API I need to activate in the console?
On appengine I only know how to get a email from the user.
var clientids = []string{WEB_CLIENT_ID, ANDROID_CLIENT_ID_d, ANDROID_CLIENT_ID_r, endpoints.ApiExplorerClientId}
var audiences = []string{WEB_CLIENT_ID}
var google_scopes = []string{"https://www.googleapis.com/auth/userinfo.email"}
func (s *Service) Google(r *http.Request, req *NoRequest, resp *User) error {
c := endpoints.NewContext(r)
g, err := endpoints.CurrentUser(c, google_scopes, audiences, clientids);
if err != nil {return err}
resp.Email=g.String()
return nil
}
Can you provide me more info about the token I must use to verify a purchase (in-app-billing v3)?
答案1
得分: 1
没问题,我会帮你翻译这段内容。这是你要翻译的内容:
不用担心,我找到了,是这个参考文档:https://developers.google.com/android-publisher/authorization
英文:
Never mind I found it, mist this reference https://developers.google.com/android-publisher/authorization
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论