<p>An equivalent for this code fragment in Craft 3 would be:</p>

<pre class="lang-php prettyprint-override"><code>        $view = Craft::$app-&gt;getView();
        $js = /** @lang JavaScript */
            &lt;&lt;&lt; EOT
(function () {
    Craft.AuthManager.checkInterval = 600; // Ten minutes
}());
EOT;
        $view-&gt;registerJs($js, $view::POS_READY);
</code></pre>

<p>For reference:</p>

<pre class="lang-php prettyprint-override"><code>    /**
     * Registers a JS code block.
     * @param string $js the JS code block to be registered
     * @param int $position the position at which the JS script tag should be inserted
     * in a page. The possible values are:
     *
     * - [[POS_HEAD]]: in the head section
     * - [[POS_BEGIN]]: at the beginning of the body section
     * - [[POS_END]]: at the end of the body section
     * - [[POS_LOAD]]: enclosed within jQuery(window).load().
     *   Note that by using this position, the method will automatically register the jQuery js file.
     * - [[POS_READY]]: enclosed within jQuery(document).ready(). This is the default value.
     *   Note that by using this position, the method will automatically register the jQuery js file.
     *
     * @param string $key the key that identifies the JS code block. If null, it will use
     * $js as the key. If two JS code blocks are registered with the same key, the latter
     * will overwrite the former.
     */
</code></pre>

CC BY-SA 4.0
2020-05-28T16:17:30.103Z
2020-05-29T01:24:28.560Z
2020-05-29T01:24:28.560Z
andrew.welch
<p>Unfortunately, the AJAX call to <code>getAuthTimeout</code> is <a href="https://github.com/pixelandtonic/Craft-Release/blob/master/app/resources/js/craft.js#L7057" rel="nofollow">hard coded</a> to fire every 60 seconds. In other words, if you're looking for a <a href="https://craftcms.com/docs/config-settings" rel="nofollow">config value</a>, there isn't one – might be worth a <a href="http://feedback.craftcms.com/forums/285221-feature-requests" rel="nofollow">feature request</a>?</p>

<p>For a quickfix/hack, you can create a <a href="https://craftcms.com/docs/plugins/introduction" rel="nofollow">custom plugin</a> and add the following to its <code>init</code> method:</p>

<pre><code>craft()-&gt;templates-&gt;includeJs('(function () {
    Craft.AuthManager.checkInterval = 600; // Ten minutes
}());', true);
</code></pre>

<p>You can change the <code>600</code> to any number of seconds, of course.</p>

<p>If you want to kill the timeout check <em>completely</em>, you can do this instead of the above:</p>

<pre><code>craft()-&gt;templates-&gt;includeJs('(function () {
    Craft.AuthManager.prototype.setCheckAuthTimeoutTimer = function () {};
}());', true);
</code></pre>

<p>Of course, both of these snippets are total hacks. Use with caution!</p>

<p>One important thing to note is that I don't think its possible to stop the <em>first</em> AJAX call to <code>getAuthTimeout</code> (which will fire after 60 seconds). The reason is that by the time the JavaScript hack inside the <code>includeJs</code> handler has fired, the <code>Craft.AuthManager</code> class has already been initialized and created the first timeout object. There's no reference to this timeout stored anywhere on the <code>Craft</code> object (that I've been able to find, at least), which makes it impossible to clear it, unfortunately.</p>

CC BY-SA 3.0
2016-03-10T15:33:13.433Z
2016-03-10T15:33:13.433Z
Mats Mikkel Rummelhoff
<p>The host of a client is claiming the call to getAuthTimeout is triggering their firewall, and in turn blocks my client from accessing their site for a longer duration.</p>

<p>Is there a way to disable or change the interval?</p>

CC BY-SA 3.0
2016-03-10T18:17:00.183Z
An extra request every 60 seconds is above their threshold?
Brad Bell
CC BY-SA 3.0
2016-03-11T00:15:43.177Z
@ Brad: seriously. An extra getAuthTimeout every minute?  If a company is that concerned about security, they should whitelist the remote IP.  Or use a remote VPN connection. I've gotten brute force attempts on my WP installs at 500+/requests second.
RitterKnight
CC BY-SA 3.0
2016-03-11T12:27:11.390Z
Well, I forgot to mention that the support person said it was triggering every couple milliseconds, which I have no reason to believe is true. I've asked them for logs and more details, but in general they have been very vague and incompetent in their answers, so I don't know what to believe.
Fred Carlsen
<users><session><timeout>
How can I disable/decrease the number of calls to getAuthTimeout?
# How can I disable/decrease the number of calls to getAuthTimeout?

(Asked by: username_0 on 2016-03-10)

The host of a client is claiming the call to getAuthTimeout is triggering their firewall, and in turn blocks my client from accessing their site for a longer duration.

Is there a way to disable or change the interval?

**Tags:** users, session, timeout
> **Comments:**
> **username_1**: An extra request every 60 seconds is above their threshold?  
> **username_2**: @ Brad: seriously. An extra getAuthTimeout every minute?  If a company is that concerned about security, they should whitelist the remote IP.  Or use a remote VPN connection. I've gotten brute force attempts on my WP installs at 500+/requests second.  
> **username_0**: Well, I forgot to mention that the support person said it was triggering every couple milliseconds, which I have no reason to believe is true. I've asked them for logs and more details, but in general they have been very vague and incompetent in their answers, so I don't know what to believe.  

---

## 2 answers

### Answer by username_4 on 2016-03-10. Score: 4 | Accepted answer

Unfortunately, the AJAX call to getAuthTimeout is hard coded to fire every 60 seconds. In other words, if you're looking for a config value, there isn't one – might be worth a feature request?
For a quickfix/hack, you can create a custom plugin and add the following to its init method:
craft()->templates->includeJs('(function () {
    Craft.AuthManager.checkInterval = 600; // Ten minutes
}());', true);

You can change the 600 to any number of seconds, of course.
If you want to kill the timeout check completely, you can do this instead of the above:
craft()->templates->includeJs('(function () {
    Craft.AuthManager.prototype.setCheckAuthTimeoutTimer = function () {};
}());', true);

Of course, both of these snippets are total hacks. Use with caution!
One important thing to note is that I don't think its possible to stop the first AJAX call to getAuthTimeout (which will fire after 60 seconds). The reason is that by the time the JavaScript hack inside the includeJs handler has fired, the Craft.AuthManager class has already been initialized and created the first timeout object. There's no reference to this timeout stored anywhere on the Craft object (that I've been able to find, at least), which makes it impossible to clear it, unfortunately.


---

### Answer by username_3 on 2020-05-28. Score: 1

An equivalent for this code fragment in Craft 3 would be:
        $view = Craft::$app->getView();
        $js = /** @lang JavaScript */
            <<< EOT
(function () {
    Craft.AuthManager.checkInterval = 600; // Ten minutes
}());
EOT;
        $view->registerJs($js, $view::POS_READY);

For reference:
    /**
     * Registers a JS code block.
     * @param string $js the JS code block to be registered
     * @param int $position the position at which the JS script tag should be inserted
     * in a page. The possible values are:
     *
     * - [[POS_HEAD]]: in the head section
     * - [[POS_BEGIN]]: at the beginning of the body section
     * - [[POS_END]]: at the end of the body section
     * - [[POS_LOAD]]: enclosed within jQuery(window).load().
     *   Note that by using this position, the method will automatically register the jQuery js file.
     * - [[POS_READY]]: enclosed within jQuery(document).ready(). This is the default value.
     *   Note that by using this position, the method will automatically register the jQuery js file.
     *
     * @param string $key the key that identifies the JS code block. If null, it will use
     * $js as the key. If two JS code blocks are registered with the same key, the latter
     * will overwrite the former.
     */


---

