你可以帮我解决下面的问题.
我只是编写一个简单的代码来检索我的谷歌+域用户配置文件.1.我正在使用域名为spaceandhow.com的谷歌+域帐户
我已提供https://developers.google.com/identity/protocols/OAuth2ServiceAccount#delegatingauthority中列出的所有权限
该帐户已启用Google+ API和Google+域Api.
这是我写的功能.
func (p *GoogleAUTH) sendGoogleAuthReq(){
fmt.Println("GoogleAUTH package: Enter sendGoogleAuthReq")
data, err := ioutil.ReadFile("D:\\Cygwin\\home\\praprasa\\pragna2.json")
if err != nil {
fmt.Printf("ReadFile error: %s", err)
}
conf, err := google.JWTConfigFromJSON(data, "https://www.googleapis.com/auth/plus.me")
if err != nil {
fmt.Println("json error")
}
client := conf.Client(oauth2.NoContext)
resp, err := client.Get("https://www.googleapis.com/plusDomains/v1/people/me")
if err != nil {
fmt.Printf("GoogleAUTH package: request execution failed: %s", err)
return
}
defer resp.Body.Close()
fmt.Println("GoogleAUTH package: response Status:", resp.Status)
fmt.Println("GoogleAUTH package: response Headers:", resp.Header)
body, err := ioutil.ReadAll(resp.Body) …Run Code Online (Sandbox Code Playgroud) download go user-profile http-status-code-403 google-domain-api