lib/functions/authenticate.js
function getTokenDefault(code, token, oauth2Client) {
    return new Promise((resolve, reject) => {
        const requestData = {
            code,
            token,
        };
        request({
            url: 'https://us-central1-gas-include.cloudfunctions.net/getToken',
            method: "POST",
            json: true,
            headers: {
                "content-type": "application/json",
            },
            body: requestData,
        }, (error, response, body) => {
            const token = body;
            if (error) {
                reject(error);
            } else if (response.statusCode === 200) {
                resolve(token);
            } else {
                reject({
                    message: 'Failed to get a token for the default Oauth client.',
                    print: true,
                });
            }
        });
    });
}
function getTokenDefault(code, token, oauth2Client) {
    return new Promise((resolve, reject) => {
        const requestData = {
            code,
            token,
        };
        request({
            url: 'https://us-central1-gas-include.cloudfunctions.net/getToken',
            method: "POST",
            json: true,
            headers: {
                "content-type": "application/json",
            },
            body: requestData,
        }, (error, response, body) => {
            const token = body;
            if (error) {
                reject(error);
            } else if (response.statusCode === 200) {
                resolve(token);
            } else {
                reject({
                    message: 'Failed to get a token for the default Oauth client.',
                    print: true,
                });
            }
        });
    });
}
function getTokenDefault ( code , token , oauth2Client ) { return new Promise ( ( resolve , reject ) => { const requestData = { code , token , } ; request ( { url : 'https://us-central1-gas-include.cloudfunctions.net/getToken' , method : "POST" , json : true , headers : { "content-type" : "application/json" , } , body : requestData , } , ( error , response , body ) => { const token = body ; if ( error ) { reject ( error ) ; } else if ( response . statusCode === 200 ) { resolve ( token ) ; } else { reject ( { message : 'Failed to get a token for the default Oauth client.' , print : true , } ) ; } } ) ; } ) ; }
Get a token for a the defaut Oauth client.

@param {google.auth.OAuth2} code - Optional code to get token for.
@param {google.auth.OAuth2} token - Optional token to refresh.
@param {google.auth.OAuth2} oauth2Client - The OAuth2 client to get token for.
@returns {Promise} - A promise resolving a tokent
Get a token for a the defaut Oauth client .