Restrict API access per IP address

Hi
Thanks for reply,
This not solve authentication issue with piwik wordpress plugin :frowning:

This is my actual htaccess:

<Files "*">
 AuthType Basic
 AuthName "Piwik"
 to be explicit, state the provider
 AuthBasicProvider file
 AuthUserFile "/pathtomymatomo/.htpasswd"
 Require valid-user
</Files>

# Allow external access to piwik.php, matomo.php, piwik.js, piwik.php and robots.txt
<FilesMatch "(^(piwik|matomo)\.(php|js)|robots\.txt)">
 Require all granted
</FilesMatch>

# Allow Opt-Out
<Files "index.php">
 <If "(%{QUERY_STRING} =~ /^module\=CoreAdminHome\&action\=optOut(?!.*module\=)(?!.*action\=)/)">
   Require all granted
 </If>
 <Else>
   Require ip my server ip       
 </Else>
</Files>

When I comment out all <Files “*”> section I can successful login to piwik through piwik wordpress plugin and auth token. But then don’t have auth on my piwik website.
When I turn on this this section then auth works perfectly but piwik wordpress plugin can connect with my token details.