[curl] Make login function reusable.
[javascript] Add small script to get access token and pass it to the javascript app.