MarSoft / PebbleNotes

Pebble client for GoogleTasks
MIT License
31 stars 14 forks source link

Token renewal fails #19

Closed MarSoft closed 10 years ago

MarSoft commented 10 years ago

For some reason, if we (automatically) renew token, subsequent API request (from renew:success handler) gets "Login required" error. But later everything works..

MarSoft commented 10 years ago

Example log:

[INFO    ] PebbleNotes__1/pebble-js-app.js:193 Querying all tasklists
[INFO    ] D comm.c:101 Message sent
[INFO    ] PebbleNotes__1/pebble-js-app.js:30 xhr:error 401
{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "authError",
    "message": "Invalid Credentials",
    "locationType": "header",
    "location": "Authorization"
   }
  ],
  "code": 401,
  "message": "Invalid Credentials"
 }
}

[INFO    ] PebbleNotes__1/pebble-js-app.js:92 Renewing token and retrying...
[INFO    ] PebbleNotes__1/pebble-js-app.js:113 Renewing token!
[INFO    ] PebbleNotes__1/pebble-js-app.js:26 xhr:success
[INFO    ] PebbleNotes__1/pebble-js-app.js:121 Renewed. {"access_token":"ya29.1.AADtN_UuX83k5LSbytdhN3SJ-R3Dtaaun4r7zBrHMs-AK6e5hWgNsnMbrb01CpchF8qOF2E","token_type":"Be
arer","expires_in":3600}
[INFO    ] PebbleNotes__1/pebble-js-app.js:30 xhr:error 401
{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "required",
    "message": "Login Required",
    "locationType": "header",
    "location": "Authorization"
   }
  ],
  "code": 401,
  "message": "Login Required"
 }
}

[INFO    ] PebbleNotes__1/pebble-js-app.js:95 Renewal didn't help! 401: Login Required
[INFO    ] PebbleNotes__1/pebble-js-app.js:143 Sending error msg to Pebble (Not implemented): Login Required (401)
MarSoft commented 10 years ago

Must be fixed now; test required.

MarSoft commented 10 years ago

Still not working:

[INFO    ] PebbleNotes__1/pebble-js-app.js:206 Querying all tasklists                                                                                          [131/1831]
[INFO    ] D comm.c:107 Message sent
[INFO    ] PebbleNotes__1/pebble-js-app.js:30 xhr:error 401
{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "authError",
    "message": "Invalid Credentials",
    "locationType": "header",
    "location": "Authorization"
   }
  ],
  "code": 401,
  "message": "Invalid Credentials"
 }
}

[INFO    ] PebbleNotes__1/pebble-js-app.js:92 Renewing token and retrying...
[INFO    ] PebbleNotes__1/pebble-js-app.js:114 Renewing token!
[INFO    ] PebbleNotes__1/pebble-js-app.js:26 xhr:success
[INFO    ] PebbleNotes__1/pebble-js-app.js:122 Renewed. {"access_token":"ya29.1.AADtN_VF6GknWlp0LduOWfTcHeLQ13bbO1MSiD39ddjkTShKS4g587XvU-0dCRw","token_type":"Bearer","e
xpires_in":3600}
[INFO    ] PebbleNotes__1/pebble-js-app.js:30 xhr:error 400
{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "parseError",
    "message": "Parse Error"
   }
  ],
  "code": 400,
  "message": "Parse Error"
 }
}

[INFO    ] PebbleNotes__1/pebble-js-app.js:96 Renewal didn't help! 400: Parse Error
[INFO    ] PebbleNotes__1/pebble-js-app.js:144 Sending error msg to Pebble: Parse Error (400)
[INFO    ] PebbleNotes__1/pebble-js-app.js:189 transactionId=20 for msg {"code":50,"error":"Parse Error (400)"}
[INFO    ] D comm.c:48 Message code: 50
[INFO    ] D comm.c:55 Error received: Parse Error (400)
[INFO    ] D statusbar.c:18 Status bar: Parse Error (400)

And works well after restart(/retry)

MarSoft commented 10 years ago

Fixed, tested