Skip to content
This repository has been archived by the owner on Oct 12, 2021. It is now read-only.

Commit

Permalink
Invalidate the server login when a 401 is received
Browse files Browse the repository at this point in the history
  • Loading branch information
ianb committed Dec 13, 2011
1 parent adb5077 commit 3646d66
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions addons/jetpack/lib/sync.js
Expand Up @@ -762,6 +762,7 @@ Server.prototype.isSaneRetryAfter = function (val) {

Server.prototype.checkAuthRequest = function (req) {
if (req.status === 401 && this.onautherror) {
this.logout();
this.onautherror();
}
};
Expand Down
13 changes: 13 additions & 0 deletions sync/tests/scheduler.html
Expand Up @@ -165,6 +165,19 @@ <h2>Setup</h2>
Poll: 300000 -270000
</pre>

Next, we'll give a quick try at triggering logout/auth:

<pre class="doctest">
$ writeln(service.loggedIn());
true
$ override('__testing__', {status: 401});
Completed
$ get();
...
$ writeln(service.loggedIn());
false
</pre>

</div>

</body> </html>

0 comments on commit 3646d66

Please sign in to comment.