0

我正在尝试在我的应用程序中使用 Duo Auth,但在输入密码或推送通知后,没有任何反应。我认为 Duo 会发布到登录页面或返回一些响应,但我不知道如何在 JS 中自动发布或获取响应。

我正在使用https://github.com/duosecurity/duo_php/tree/master/demos/simple示例,完整的代码可以在链接中找到。

JS中有一些功能,包括这个,但我无法通过“响应”事件达到它

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();
    }
}
4

0 回答 0