File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -9,3 +9,26 @@ This is the implementation of the concept described in
9
9
Launch demo [ here] ( http://witoldsz.github.com/angular-http-auth/ )
10
10
or switch to [ gh-pages] ( https://github.com/witoldsz/angular-http-auth/tree/gh-pages )
11
11
branch for source code of the demo.
12
+
13
+ Manual
14
+ ------
15
+
16
+ This module installs $http interceptor and provides the 'authService'.
17
+
18
+ The $http interceptor does the following:
19
+ the configuration object (this is the requested URL, payload and parameters)
20
+ of every HTTP 401 response is buffered and everytime it happens, the
21
+ 'event: auth-loginRequired ' message is broadcasted from $rootScope.
22
+
23
+ The 'authService' has only one method: #loginConfirmed().
24
+ You are responsible to invoke this method after user logged in.
25
+ It will retry all the requests previously failed due to HTTP 401 response.
26
+
27
+ ###Typical use case:
28
+
29
+ * somewhere the: ** $http(...).then(function(response) { do-something-with-response })** is invoked,
30
+ * the response of that requests is a HTTP 401,
31
+ * 'http-auth-interceptor' captures the initial request and broadcasts 'event: auth-loginRequired ',
32
+ * your application intercepts this to e.g. show a login dialog (or whatever else),
33
+ * once your application figures out the authentication is OK, you are to call: ** authService.loginConfirmed()** ,
34
+ * your initial failed request will now be retried and finally, the ** do-something-with-response** will fire.
You can’t perform that action at this time.
0 commit comments