Communicate with rest api server, with Get/Post/Delete/Put etc.
Verify the http response status code, if it's failed for authentication, then popup the Login window.
If users input the credential, try to authenticate. If it's successful, then close the Login window, and submit the previous failed rest request. It means each request should be cached in global variables.
Callback the original requesters or return a future handler.
Rest Client API: