Implement the view of login page (or modal dialog)
Talk with the server to finish authentication.
Cooperate with the client rest api. If the client rest api received an authentication failure response, then the login page can be poped up. When it succeeded to submit the credentials, the client rest api can retry the previous request.