Answers.Body: <p><strong>This is completely inaccurate, please disregard!</strong> I’ll work with Chad to come up with something useful, or delete it outright.</p>
  <hr />
  <p>Multi-environment <a href="https://craftcms.com/docs/3.x/config/config-settings.html" rel="nofollow noreferrer">configuration</a> (3.x) uses site handles at the top level of the returned array.</p>
  <p>Currently, Craft interprets this as having the following <code>defaultTokenDuration</code> for all sites…</p>
  <pre class="lang-php prettyprint-override"><code>[
    '*' =&gt; 259200,
    'otherSite' =&gt; 1800,
  ]
  </code></pre>
  <p>…which isn't a valid &quot;duration&quot; format! </p>
  <p>Instead, your config file should look something like this:</p>
  <pre class="lang-php prettyprint-override"><code>return [
     '*' =&gt; [
          'defaultTokenDuration' =&gt; 259200,
      ],
      'otherSite' =&gt; [
          'defaultTokenDuration' =&gt; 1800,
      ],
  ];
  </code></pre>
  <p> <strong>Keep in mind:</strong> These tokens aren’t always generated in circumstances where the current &quot;site&quot; is known or defined—for example, an administrator sending a password reset email to a user, or a live preview request.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-25T20:31:07.453Z
Answers.Text: Thank you - but my config array at the top level is environment-specific, not site specific. Can you explain how I'd add the otherSite array to this? https://gist.github.com/chadcrowell/d5fce78742c0185fd3c32b509613aeba
Answers.UserDisplayName: Chad Crowell
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-24T17:17:53.223Z
Answers.LastActivityDate: 2022-10-26T20:31:02.197Z
Answers.LastEditDate: 2022-10-26T20:31:02.197Z
Answers.UserDisplayName: August Miller
Body: <p>I currently have a multi-site Craft 3 install with this in the general.php config file (amongst other settings)</p>
  <pre><code>return [
     '*' =&gt; [
         'defaultTokenDuration' =&gt; 259200, //72 hours
      ]
  ]
  </code></pre>
  <p>Which works fine for all sites allowing logged in users to remain logged in for 72 hours. I'm adding a new site where we need the duration to be 30 minutes.</p>
  <p>I tried this:</p>
  <pre><code>return [
     '*' =&gt; [
          'defaultTokenDuration' =&gt; [
              '*' =&gt; 259200, //72 hours
              'otherSite' =&gt; 1800 //30 minutes
          ]
      ]
  ]
  </code></pre>
  <p>where 'otherSite' is the handle of the new site. Craft is throwing this error:</p>
  <p><code>yii\base\InvalidConfigException: Unable to convert to seconds. in /Users/chad/Repos/gcx-craft/vendor/craftcms/cms/src/helpers/ConfigHelper.php:49</code></p>
  <p>I also tried replacing the * with the handle of the primary site and saw the same error, so I assume listing all sites with a value in that array is useless. Is there any way to specify different values for different sites for this setting?</p>
  
Tags: <users><session>
Title: Multi-Site Craft 3 - How to set defaultTokenDuration to shorter duration for just 1 of the sites?
ThreadText: # Multi-Site Craft 3 - How to set defaultTokenDuration to shorter duration for just 1 of the sites?
  
  (Asked by: username_0 on 2022-10-24)
  
  I currently have a multi-site Craft 3 install with this in the general.php config file (amongst other settings)
  
  ```
  return [
     '*' => [
         'defaultTokenDuration' => 259200, //72 hours
      ]
  ]
  
  ```
  
  Which works fine for all sites allowing logged in users to remain logged in for 72 hours. I'm adding a new site where we need the duration to be 30 minutes.
  
  I tried this:
  
  ```
  return [
     '*' => [
          'defaultTokenDuration' => [
              '*' => 259200, //72 hours
              'otherSite' => 1800 //30 minutes
          ]
      ]
  ]
  
  ```
  
  where 'otherSite' is the handle of the new site. Craft is throwing this error:
  
  `yii\base\InvalidConfigException: Unable to convert to seconds. in /Users/username_0/Repos/gcx-craft/vendor/craftcms/cms/src/helpers/ConfigHelper.php:49`
  
  I also tried replacing the \* with the handle of the primary site and saw the same error, so I assume listing all sites with a value in that array is useless. Is there any way to specify different values for different sites for this setting?
  
  **Tags:** users, session
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-10-24. Score: 0
  
  **This is completely inaccurate, please disregard!** I’ll work with username_0 to come up with something useful, or delete it outright.
  
  ---
  
  Multi-environment [configuration](https://craftcms.com/docs/3.x/config/config-settings.html) (3.x) uses site handles at the top level of the returned array.
  
  Currently, Craft interprets this as having the following `defaultTokenDuration` for all sites…
  
  ```php
  [
    '*' => 259200,
    'otherSite' => 1800,
  ]
  
  ```
  
  …which isn't a valid "duration" format!
  
  Instead, your config file should look something like this:
  
  ```php
  return [
     '*' => [
          'defaultTokenDuration' => 259200,
      ],
      'otherSite' => [
          'defaultTokenDuration' => 1800,
      ],
  ];
  
  ```
  
  **Keep in mind:** These tokens aren’t always generated in circumstances where the current "site" is known or defined—for example, an administrator sending a password reset email to a user, or a live preview request.
  
  > **Comments:**
  > **username_0**: Thank you - but my config array at the top level is environment-specific, not site specific. Can you explain how I'd add the otherSite array to this? https://gist.github.com/username_0/d5fce78742c0185fd3c32b509613aeba  
  
  ---
  
  