()
| 15 | }; |
| 16 | |
| 17 | function getCredentials() { |
| 18 | return fs.readFileAsync(defaults.STORAGE_FILE) |
| 19 | .then(JSON.parse) |
| 20 | .catch(SyntaxError, function(e) { |
| 21 | console.log('Could not parse credentials'.red); |
| 22 | }) |
| 23 | .error(function(e) { |
| 24 | console.log('Could not read path to credentials file. Please check your path and try again'.red); |
| 25 | throw err; |
| 26 | }); |
| 27 | } |
| 28 | |
| 29 | function createAuthClient(credentials) { |
| 30 | var auth = new OAuth2Client( |