You must decode the Google ID token returned by POST https://www.googleapis.com/oauth2/v4/token
to convert it into a Google+ ID then you may use GET https://www.googleapis.com/plus/v1/people/[gplusID]?access_token=[accessToken]
Using Go, you can decode the google ID token using the following
function. Normally, it is critical that you validate an ID token
before you use it, but since you are communicating directly with
Google over an intermediary-free HTTPS channel and using your Client
Secret to authenticate yourself to Google, you can be confident that
the token you receive really comes from Google and is valid. If your
server passes the ID token to other components of your app, it is
extremely important that the other components validate the token
before using it.
Using Go, you can decode the ID token with the following function.
func decodeGoogleIDToken(idToken string) (gplusID string, err error) {
var set struct {
Sub string
}
if idToken != "" {
// Check that the padding is correct for a base64decode
parts := strings.Split(idToken, ".")
if len(parts) < 2 {
return "", fmt.Errorf("Malformed ID token")
}
// Decode the ID token
s := parts[1]
switch len(s) % 4 {
case 2:
s += "=="
case 3:
s += "="
}
b, err := base64.URLEncoding.DecodeString(s)
if err != nil {
return "", fmt.Errorf("Malformed ID token: %v", err)
}
err = json.Unmarshal(b, &set)
if err != nil {
return "", fmt.Errorf("Malformed ID token: %v", err)
}
}
return set.Sub, nil
}
Check out an example here at https://play.golang.org/p/M7sYmE2ztx