Could you help me with the problem below.
I am just writing simple code to get my google + Domain user profile. 1. I am using a google + Domain account with the domain name spaceandhow.com
I have granted all privileges listed at https://developers.google.com/identity/protocols/OAuth2ServiceAccount#delegatingauthority
The account includes both the Google+ API and the Api Google+ domain.
This is the function I wrote.
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) if err != nil { fmt.Printf("GoogleAUTH package: cannot fetch token: %v", err) return } fmt.Println("GoogleAUTH package: response Body:", string(body)) fmt.Println("GoogleAUTH package: Exit sendGoogleAuthReq") }
This is the error message I get
GoogleAUTH package: response Status: 403 Forbidden GoogleAUTH package: response Headers: map[Vary:[Origin X-Origin] X-Frame-Options:[SAMEORIGIN] X-Xss-Protection:[1; mode=block] Cache-Control:[private, max-age=0] Server:[GSE] Date:[Sat, 29 Aug 2015 07:55:47 GMT] Content-Type:[application/json; charset=UTF-8] Expires:[Sat, 29 Aug 2015 07:55:47 GMT] X-Content-Type-Options:[nosniff] Alternate-Protocol:[443:quic,p=1] Alt-Svc:[quic=":443"; p="1"; ma=604800]] GoogleAUTH package: response Body: { "error": { "errors": [ { "domain": "global", "reason": "forbidden", "message": "Forbidden" } ], "code": 403, "message": "Forbidden" } }
source share