2016-07-16

I'm trying to call the google analytics api in node. Can anybody tell me what I'm doing wrong? I'm getting 'path.replace is not a function' in node_modules/mime/mime.js, but I'm certain the problem is with my auth. (my log is not being hit btw)

UPDATE: I tried to use an API key instead like so. In this case my log does get hit. But I get a 'Login Required' error.

this oauth playground https://developers.google.com/oauthplayground/ leads me to believe you need a google analytics login and scope to get an authorization code. And with the authorization code you can get an access token. And once you have that you can simply make the request with parameters to get what you need. The problem is getting it in code.

The code snippets I've seen that involve getting the Authorization code do it in a way that has the user get it from a consent page (like here https://github.com/google/google-api-nodejs-client#retrieve-authorization-code), but I'm just trying to do a server to server app, and I'm not getting user data so I shouldn't need permission from a user.

Show more