updated doc

This commit is contained in:
Yann Esposito 2014-09-26 15:53:55 +02:00
parent 9ac0600019
commit 9f46583087
2 changed files with 7 additions and 51 deletions

View file

@ -31,6 +31,13 @@ Then
And use `wrap-open-cors` as middleware. And use `wrap-open-cors` as middleware.
## Limitations
There is a bug with Safari.
The only way to make it works is by using a _very_ dirty trick:
<http://anantgarg.com/2010/02/18/cross-domain-cookies-in-safari/>
## License ## License
Copyright © 2014 Yann Esposito Copyright © 2014 Yann Esposito

View file

@ -1,51 +0,0 @@
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
var murl="http://m4.vigiglo.be:3000/api";
function getMe(){
$.ajax(
{url: murl + "/resources/whoami"
, type: 'GET'
, success: function(data){alert(data)}
, error: function(data,status){alert("WHOAMI ERROR: " + status);}
});
}
function login(next){
$.ajax(
{url: murl + "/login"
, type: 'GET'
, data: {username: 'teser@test.com', password: 'test'}
, success: getMe
, error: function(data,status){alert("LOGIN ERROR: " + status);
next();
}
, xhrFields: { withCredentials: true }
, crossDomain: true
});
}
function argh(pref){
return function(data,status){
alert(pref + ": " + data.toString());
alert(pref + ": " + status.toString());
};
}
function logout(next){
$.ajax(
{url: murl + "/logout"
, type: 'GET'
, success: next
, error: argh("logout")
, xhrFields: { withCredentials: true }
, crossDomain: true
});
}
$(document).ready(function(){
logout( function(){login ( getMe )} );
});
</script>
</head>
<body>
HERE
</body>
</html>