Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5638403

Browse files
committed
Manual in README.md.
1 parent 37416b4 commit 5638403

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,26 @@ This is the implementation of the concept described in
99
Launch demo [here](http://witoldsz.github.com/angular-http-auth/)
1010
or switch to [gh-pages](https://github.com/witoldsz/angular-http-auth/tree/gh-pages)
1111
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.

0 commit comments

Comments
 (0)