percolatestudio / meteor-google-api

A simple API encapsulating some common patterns regarding Google's APIs
https://atmospherejs.com/percolate/google-api
MIT License
48 stars 30 forks source link

refreshing token fails because options.user gets deleted too early #29

Open znat opened 8 years ago

znat commented 8 years ago

options.user is undefined here https://github.com/percolatestudio/meteor-google-api/blob/master/google-api-async.js#L19

because it was deleted there https://github.com/percolatestudio/meteor-google-api/blob/master/google-api-async.js#L43

As a result, when Meteor.user() is not available the token cannot refreshed.

Gsuz commented 8 years ago

after about 30 minutes of inactivity I need to relog the user, is this connected?

kodie commented 7 years ago

I'm having the same issue as Gsuz which is possible related to OP's issue.

Using version 1.0.3_1 of the plugin.

Exception in callback of async function: Error: [Error: failed [401] {  "error": {   "errors": [    {     "domain": "global",     "reason": "authError",     "message": "Invalid Credentials",     "locationType": "header",     "location": "Authorization"    }   ],   "code": 401,   "message": "Invalid Credentials"  } } ]

After logging back into the user, the token get's refreshed and everything is fine but it doesn't get automatically refreshed when passing options.user like it's supposed to.