Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7876257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:08:26+00:00 2026-06-03T03:08:26+00:00

I am trying to write a login function with dojo. In my case, I

  • 0

I am trying to write a login function with dojo. In my case, I need a post request to a extern (!!) server in this case:

login is defined as followed:

login

Login is a special action, not handling any data, but authenticating a user. A POST request is to be made, containing a json object with keys ’email’ and ‘password’. The return value is either true or false. A special Cookie is returned for further identification.

Valid API Calls

URL: /api/login

Method: POST

Fields:

email

password

Description: Returns all data for the logged in user in PLIST format. if login fails, false is returned in PLIST format.

Well, I tried to solve that problem with a io.iframe.send call, but i get the following error: Error: Permission denied to access property ‘getElementsByTagName’

However, I am even not sure, if io.iframe is the correct way to solve my problem.

Perhaps you can help me
Thanks a lot

PS: My current code looks like this:

function login(){
    require(["dojo/io/iframe", "dojo/dom"], function(iframe, dom){
        var email = dom.byId("logEmail").value;
        var password = dom.byId("logPassword").value;

        function JSONreq(){

            var jsonpArgs = {
                method: 'POST',
                handleAs:"json",
                content:{
                    email: email,
                    password: password

                },
                url: "http://---someServerThatIDontWantToName---/api2/login",
                load: function (response, ioargs){
                    //console.log(response)
                    alert('succes');
                },
                error: function(response, ioargs){
                    alert("error");
                }
            };
            iframe.send(jsonpArgs);
        }
        dojo.ready(JSONreq);

    });
};

is there any difference in mobile development? cross server post requests should be possible on a mobile device.

so: can i use io.iframe.send for this reason?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:08:27+00:00Added an answer on June 3, 2026 at 3:08 am

    Anser in short is, you cannot at any given time use POST request on a X-domain via browser client. Reason is, the DOM is protected on another namespace and what is happening through io.iframe is;

    1. establish GET request
    2. find form, check foreach (local) name/value content keypair if (remote) input exists
      • if not exists, create as such: dojo.create("input", {type: "hidden", name: name, value: value}, fn);
      • else if it does, set the value on form.element-of-name.

    So, first of all DOM lookup will fail in 2) due to security restrictions, meaning ‘not exists’, then in turn, 2.1) dojo.create will fail with same reason.

    Typical workarounds are

    1. Open GET method in your x-domainserver/api/login (set url: prefix + dojo.formToQuery(form)
    2. Create an in which url refreshes on a polling interval, making login keep-alive
    3. Create a ‘jumphost’ on your samehost-server/api/login/passthrough which serverside does POST to x-domainserver/api/login, then returns result. Giving PHP solution for this

      $allowedDomains = array(
      “http://facebook.whatever.org/”,
      “http://yournavigation.org/”);

      // The target request uri on x-domain, say “form action”
      $action = $_REQUEST[“url”];

      // Method only looks for POST and defaults GET
      $method = $_REQUEST[“method”];

      // Query placeholder, filled by rolling through _REQUEST, will append all but method / url pairs
      $fields = “”;

      // Authorize against allowedDomains or die

      foreach ($allowedDomains as $domain) {

      if (strpos(substr($action, 0, strlen($domain)), $domain) !== false) {
      header("HTTP/1.0 403 Forbidden");
      die("Domain name "".$action."" not allowed. Access denied.");
      flush();
      }
      

      }

      if (count($_REQUEST) > 2) {

      foreach ($_REQUEST as $key => $value) {
      
          if ($key != "url" && $key != "method") // append anything but url and method
              $fields .= $key . "=" . rawurlencode($value) . "&";
      }
      

      }
      $fields = substr($fields, 0, strlen($fields) – 1);

      // Setup curl
      $ch = curl_init();
      if (strtoupper($method) == “POST”) {
      curl_setopt($ch, CURLOPT_URL, $action);
      curl_setopt($ch, CURLOPT_POST, 1);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
      } else {
      curl_setopt($ch, CURLOPT_URL, $action . “?” . $fields);
      }
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
      curl_setopt($ch, CURLOPT_USERAGENT, “transport.php (CURL)”);

      // Send, catch returning response and close
      $response = curl_exec($ch);
      $info = curl_getinfo($ch);
      curl_close($ch);

      // Reply response to client XHR
      header(“Content-type: “.$info[“content_type”]);
      echo $response;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to php and trying to write a login function. Bit stuck
I am trying to write a function to post form data and save returned
I'm trying to write a function, which will execute on user login. It should
I am trying to write a function that will understand how to login using
Hey im trying to write code for a login system, this is my first
I'm trying to send data through a POST request from a node.js server to
I am trying to write a WSH logon script. Administrators throughout the company need
I am trying write a function that generates simulated data but if the simulated
Trying to write a function to see how often an object exists and give
I need to write authentication function with asynchronous callback from remote Auth API. Simple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.