Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore non-hardcoded JWT #7

Open
shankari opened this issue Feb 22, 2016 · 2 comments
Open

Restore non-hardcoded JWT #7

shankari opened this issue Feb 22, 2016 · 2 comments

Comments

@shankari
Copy link
Contributor

We now know the issues related to the bad JWTs earlier:

  • the background sync was terminating too early, and
  • we were not trying to refresh the token if it was initially NULL (6a8ac0c)

Now that these issues have been resolved, we can move back to the original plan with the non-hardcoded JWTs. Need to think about whether that is better (involves more native calls but gives us XHR functionality which can give us nice progress bars like
http://github.hubspot.com/pace/docs/welcome/

@shankari
Copy link
Contributor Author

High level design:

  • separate UI and silent auth
  • for silent auth
    • have a function to read the auth token from the keychain (getToken)
    • have a function to refresh the token (refreshToken)
    • have a function to getValidAuth which reads the token and refreshes it if necessary
    • have a function to refreshToken which reads the token and forces a refresh if necessary
  • In the remote calls, use getValidAuth
  • In background sync, invoke refreshToken in parallel with the other calls so that we will have a refreshed token available for the next sync.

Actually, we may want to just do this for every remote push instead for every background sync. That will ensure that:

  • we refresh even when the trip is ongoing
  • when a trip is ending, we refresh in parallel with the geofence creation, so we can hopefully finish both tasks. Let us try it and figure out!!

@shankari
Copy link
Contributor Author

we have separated UI and silent auth, and come up with a good interface in
e-mission/cordova-jwt-auth#17

We could change the javascript code to use getJWT instead...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant