js-threads
js-threads copied to clipboard
Refactor: Rename `getToken` to `authorize`
There is a bit of confusion about the point of getToken. It appears on its face to be something more like an authenticate api. However, a user's token doesn't need to change, so you only technically have to get a user their token one single time in their lifetime in the app. So, what's a good way to clarify this api?
Maybe getToken shouldn't live on the the Database/Client classes? It might be nice to have a User class for something like getToken and then more explicitly on Client just a setToken... That's just one idea though.
I've settled on these terms
authenticate is what the developer does with the hub api. they authenticate with their api key/secret
authorize is what the developer does with a user identity and the api. they authorize a user identity to use their hub api endpoint for a period of time.
so i think getToken should just become client.authorize(identity)
This is being done as part of The Great Refactor (#414) work.