如何在goauth2中使用appengine/urlfetch包?

huangapple go评论68阅读模式
英文:

How do I use the appengine/urlfetch package with goauth2?

问题

goauth2包有一个示例用法。但在应用引擎上,普通的http.Client不可用。我该如何在应用引擎中使用urlfetch包与goauth2一起使用?

英文:

The goauth2 package has an example use. But on app engine, the normal http.Client isn't available. How do I use the app engine urlfetch package with goauth2?

答案1

得分: 6

你必须在回调的第一行中添加一个Transport参数:

t := &oauth.Transport{
	Config:    oauth_conf,
	Transport: &urlfetch.Transport{Context: c},
}
英文:

You must add a Transport parameter to the first line of the callback:

t := &oauth.Transport{
	Config:    oauth_conf,
	Transport: &urlfetch.Transport{Context: c},
}

huangapple
  • 本文由 发表于 2013年3月16日 13:49:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/15446050.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定