Incorrect hasAuthentication check causes authentication to run when not required in OpenAiBasedProviderClientBase
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3561504. --> Reported by: [mxr576](https://www.drupal.org/user/315522) Related to !1035 >>> <p>[Tracker]<br> <strong>Update Summary: </strong>[One-line status update for stakeholders]<br> <strong>Short Description: </strong>[One-line issue summary for stakeholders]<br> <strong>Check-in Date: </strong>MM/DD/YYYY<br> <em>Metadata is used by the <a href="https://www.drupalstarforge.ai/" title="AI Tracker">AI Tracker.</a> Docs and additional fields <a href="https://www.drupalstarforge.ai/ai-dashboard/docs" title="AI Issue Tracker Documentation">here</a>.</em><br> [/Tracker]</p> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>I think <code>\Drupal\ai\Base\OpenAiBasedProviderClientBase::hasAuthentication()</code> is incorrectly used in <code>\Drupal\ai\Base\OpenAiBasedProviderClientBase::loadClient() </code> at least it is not aligned with the document of the method:</p> <pre>&nbsp; /**<br>&nbsp;&nbsp; * Indicates if the provider requires authentication.<br>&nbsp;&nbsp; *<br>&nbsp;&nbsp; * @return bool<br>&nbsp;&nbsp; *&nbsp;&nbsp; TRUE if authentication is required, FALSE otherwise.<br>&nbsp;&nbsp; */<br>&nbsp; public function hasAuthentication(): bool;</pre><p>The current code in loadClient() sets authentication on the client when hasAuthentication() is false.</p> <h4 id="summary-steps-reproduce">Steps to reproduce (required for bugs, but not feature requests)</h4> <p>Please provide information like AI modules enabled, which AI provider, browser, etc.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <h3>Optional: Other details as applicable (e.g., User interface changes, API changes, Data model changes)</h3>
issue