Custom authentication in webservices

I have the same questions, did you get a reply for this? Also even in test connection the token is not getting retrieved, only when I hard code it works.