From separation of concerns perspective, I am not sure if forcetk should do any kind of authentication process. Also this will complicate the forcetk code to do checks on whether cordova exits, or if refresh token exists and what if refresh token itself has been revoked and so on...

IMO, forcetk should just accept some object/callback method that will be called whenever a 401 is encountered. That object/callback should then be responsible for doing the appropriate authentication and then initiate a replay of the request if required. That way one can plug in easily either the cordova plugin or even may be the forcetk-ui if required.

What you guys think?