In reply to Sher.

Hi Sher,
Unfortunately, there is not a trivial way to avoid the browser and auth code. Perhaps it's possible with some fancy scripting, but I've yet to figure that out. I did write some scripts that partially automates the client registration and access and refresh token generation. It's here on GitHub. I highly recommend to utilize the refresh token to generate a new access token. You can control the token time-to-live on client or token creation.