Last active
June 5, 2018 12:23
-
-
Save prantoran/33c215798201a4f53eee3ab71c9cc615 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jbts, err := json.Marshal(PubSubKey) // assuming the data of the json key is in the PubSubKey struct | |
if err != nil { | |
log.Println("could not convert api json to bytes:", err) | |
return | |
} | |
conf, err := google.JWTConfigFromJSON(jbts, "https://www.googleapis.com/auth/pubsub") | |
if err != nil { | |
log.Fatal(err) | |
} | |
ts := conf.TokenSource(ctx) | |
client, err := pubsub.NewClient(ctx, config.ProjectID, option.WithTokenSource(ts)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment