I'm trying to open a modal window (jQuery colorbox) when the users doing login with facebook or twitter with DotNetOpenAuth. I doing an post with jQuery, but I haven't any idea why I haven't a response.
This is the HTML
<form returnurl="" action="/account/externalLogin" id="ExternalLogin" method="post" novalidate="novalidate">
<fieldset id="socialLoginList">
<legend>Log in using another service</legend>
<p>
<button type="submit" name="provider" class="lightbox" value="twitter" title="Log in using your Twitter account">Twitter</button>
<button type="submit" name="provider" class="lightbox" value="facebook" title="Log in using your Facebook account">Facebook</button>
</p>
</fieldset>
</form>
And this my javascript
$("#ExternalLogin").submit(function () {
$.post($(this).attr("action"), $(this).serialize(), function (data) {
alert(data);
}, 'html');
return false;
});
Never I have a response from $.post. What I'm doing bad?
See How can i supply an AntiForgeryToken when posting JSON data using $.ajax?
If you're using the standard account controller that comes in MVC 4 projects you'll be hitting ExternalLogin which has the attribute [ValidateAntiForgeryToken] - you can confirm this by reading your error message.
You need to send back this token otherwise the server will give you a 500 internal error.