Google app engine 对双方进行一次身份验证请求

Google app engine 对双方进行一次身份验证请求,google-app-engine,google-chrome-extension,oauth,go,Google App Engine,Google Chrome Extension,Oauth,Go,我正在做一个chrome扩展 为了方便起见,我希望在chrome端和服务器端获得用户授权 在浏览器端,我使用chrome.identity.getAuthToken(),并在提示后获得一个令牌 如果可能的话,我如何在服务器端重复使用此用户的授权而不要求两次访问?找到。。。这是我的答案,谢谢你,明蒂 导入( “fmt” “net/http” “阿彭金” “appengine/urlfetch” oauth“code.google.com/p/goauth2/oauth” 驱动器“code.goog

我正在做一个chrome扩展

为了方便起见,我希望在chrome端和服务器端获得用户授权

在浏览器端,我使用chrome.identity.getAuthToken(),并在提示后获得一个令牌


如果可能的话,我如何在服务器端重复使用此用户的授权而不要求两次访问?

找到。。。这是我的答案,谢谢你,明蒂

导入(
“fmt”
“net/http”
“阿彭金”
“appengine/urlfetch”
oauth“code.google.com/p/goauth2/oauth”
驱动器“code.google.com/p/google-api-go-client/drive/v2”
)
...
c:=appengine.NewContext(r)
传输:=&oauth.transport{
令牌:&oauth.Token{
AccessToken:“您的_令牌”,
},
传输:&urlfetch.Transport{Context:c},
}
客户端:=传输。客户端()
服务,错误:=驱动器。新建(客户端)
如果出错!=零{
//创建驱动器客户端时出错
Error(w,err.Error(),http.StatusInternalServerError)
返回
}
结果,err2:=service.About.Get().Do()
如果错误2!=零{
Error(w,err2.Error(),http.StatusInternalServerError)
返回
}
fmt.Fprintln(w,result.Name)

假设您的chrome和服务器之间的连接已加密,您可以将生成的令牌发送到服务器,并将该值用作服务器上的会话,直到客户端注销。一旦获得令牌,我如何重用它?