js-threads icon indicating copy to clipboard operation
js-threads copied to clipboard

Refactor: Rename `getToken` to `authorize`

Open andrewxhill opened this issue 5 years ago • 2 comments
trafficstars

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.

andrewxhill avatar Jun 22 '20 23:06 andrewxhill

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)

andrewxhill avatar Jul 06 '20 20:07 andrewxhill

This is being done as part of The Great Refactor (#414) work.

carsonfarmer avatar Sep 25 '20 22:09 carsonfarmer