diff --git a/src/dfp.ts b/src/dfp.ts index ffbde02..e9438e3 100644 --- a/src/dfp.ts +++ b/src/dfp.ts @@ -18,7 +18,7 @@ export class DFP { this.options = options; } - public async getService(service: string): Promise { + public async getService(service: string, token?: string): Promise { const {apiVersion} = this.options; const serviceUrl = `https://ads.google.com/apis/ads/publisher/${apiVersion}/${service}?wsdl`; const client = await promiseFromCallback((cb) => createClient(serviceUrl, cb)); @@ -29,6 +29,10 @@ export class DFP { client.setSecurity(new BearerSecurity(token)); }; + if (token) { + client.setToken(token); + } + return new Proxy(client, { get: function get(target, propertyKey) { const method = propertyKey.toString();