Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

107
Views
Duo Authenticator PHP/JS

I'm trying to use the Duo Auth in my application, but after input the passcode or the push notification, nothing happens. I think the Duo would post to the login page or return some response, but i don't know how to automatically post or get the response in the JS.

I'm using the https://github.com/duosecurity/duo_php/tree/master/demos/simple example, the full code can be found in the link.

There are some functions in the JS, including this one, but i can't reach it with the "response" event

function doPostBack(response) {
    // create a hidden input to contain the response token
    var input = document.createElement('input');
    input.type = 'hidden';
    input.name = postArgument;
    input.value = response + ':' + appSig;
    

    // user may supply their own form with additional inputs
    var form = document.getElementById('duo_form');

    // if the form doesn't exist, create one
    if (!form) {
        form = document.createElement('form');

        // insert the new form after the iframe
        iframe.parentElement.insertBefore(form, iframe.nextSibling);
    }

    // make sure we are actually posting to the right place
    form.method = 'POST';
    form.action = postAction;

    // add the response token input to the form
    form.appendChild(input);

    // away we go!
    if (typeof submitCallback === "function") {
        submitCallback.call(null, form);
    } else {
        form.submit();
    }
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!