google analytics api node.js

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)

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.