deal with authentication and authorization in single page applications