i'm using asp.net webapi. Authentication is basic authentication by Thinktecture library.
When the user logs in, the username and password is stored in a session cookie using $CookieStore
.
i'm adding the credentials to the header for every get request as below
$http.defaults.headers.common['Authorization'] = 'Basic '+$cookieStore.get('__RequestVerificationToken');
The problem is, i have to call this before every get request. Is there a way that the Angular will automatically add this to the header and when the response is 401, then the user should automatically redirect to login page.