-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
40 lines (32 loc) · 736 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"fmt"
"io/ioutil"
"log"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"github.com/google/google-api-go-client/plus/v1"
)
const key = "service_account_key.json"
func main() {
data, err := ioutil.ReadFile(key)
if err != nil {
log.Fatal(err)
}
conf, err := google.JWTConfigFromJSON(data, "https://www.googleapis.com/auth/plus.profile.emails.read")
if err != nil {
log.Fatal(err)
}
client := conf.Client(oauth2.NoContext)
plusService, err := plus.New(client)
if err != nil {
log.Fatal(err)
}
peopleService := plus.NewPeopleService(plusService)
call := peopleService.Get("105303214497629424637")
person, err := call.Do()
if err != nil {
log.Fatal(err)
}
fmt.Println(person)
}