How do i connect my authenticated service account Google People API to read contacts on my personal user account?
I have my service account JSON credentials in my environment. I am able to use the Google People API while connected to a service account. But I can't make requests to impersonate my personal user account which owns the platform.
I throws error when i add my user Gmail as subject account.
require("dotenv").config();
const { google } = require("googleapis");
let scopes = ["https://www.googleapis.com/auth/contacts"];
const init = async () => {
console.log("Auth Started");
let auth = await google.auth.getClient({
scopes,
});
// auth.subject = "username@gmail.com";
const { people } = google.people({
version: "v1",
auth,
});
let res = await people.connections.list({
resourceName: "people/me",
personFields: "names",
});
console.log(res);
};
init();
Via Active questions tagged javascript - Stack Overflow https://ift.tt/mzEuqFG
Comments
Post a Comment