In general, the approach to tokens is best just to send a username + password (basic authentication) in each request. The problem is to implement it correctly: while Basic Authentication is very easy to implement, and in fact it is already implemented by most applications and web servers, the token is what you need to implement yourself - it must be encrypted, understand this so you need some key management, it also needs to have a certain expiration date, and maybe you need a revocation cancellation function.
In addition, this will make the clientβs life more complicated: instead of simply attaching the main authentication header to each request, the client must first go to some authentication point, get a valid one, and then use the token in the requests. If the token expires, the client must again go to the authentication point.
So, if you have the time and knowledge, and your customers are smart, it is better to use the approach to tokens. Otherwise, basic authentication should be sufficient with SSL.
source share