There is a webpage, build on AngularJS with a login.
I need to iframe it on my page, and autologin my users on the site. looking at the angularJS Site, the login procedure is awaiting a json object.
I tried several ways. Submitting an array, creating a json object in js and send it. But nothing works.
The json must look like this:
{
'TAKE':{
'username': 'whatever',
'password': 'whatever'
}
}
the closest solution i had, was to create a json via js and send it with the form. The problem was, that in the request, symbols like {} and ' " was coded like:
%22%3A%7B%22
The JS i used:
function submitAsJSON(form) {
var json = "{'TAKE':{'username': 'whatever','password': 'whatever'}}";
var JSONString = JSON.stringify(json);
var newForm = "<form method='POST' action='" + $(form).attr('action') + "'>" +
"<input name='" + JSONString + "'>" +
"</form>"
$(newForm).appendTo('body').submit();
}
also looking at the headers in chrome, its awaiting:
content-type: application/json
but i am sending:
Content-Type: application/xml;
How can i send a json and let the user automatically log in?
Check if this works for you to convert form data into JSON.
For autologin you will have to handle that on serve side:
var formData = JSON.stringify($("#theFormID").serializeArray());