UNPKG

@niur/google-admanager-api

Version:
29 lines 916 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GoogleSAFileCredential = void 0; const google_auth_library_1 = require("google-auth-library"); const constants_1 = require("../common/constants"); class GoogleSAFileCredential { /** * * @param keyFile Path to a .json, .pem, or .p12 key file */ constructor(keyFile) { if (!keyFile) { throw new Error("'keyFile' must be set when using service account flow."); } this._keyFile = keyFile; this.build(); } async build() { this.auth = new google_auth_library_1.GoogleAuth({ keyFile: this._keyFile, scopes: constants_1.SCOPE, }); } async getToken() { return await this.auth.getAccessToken(); } } exports.GoogleSAFileCredential = GoogleSAFileCredential; //# sourceMappingURL=googleSAFileCredential.js.map