No Code Attached Yet bug
avatar neoman666
neoman666
14 Oct 2026

What happened?

  1. Joomla 6.2, Global Configuration → Server → Mail: Mailer = SMTP, SMTP Authentication = OAuth 2.0
  2. Configure Microsoft 365 (Entra app, single tenant) as described in the documentation of #48290
    • Token URL: https://login.microsoftonline.com/<TENANT_ID>/oauth2/v2.0/token
    • Scope: https://outlook.office.com/SMTP.Send offline_access
  3. Save, start the OAuth authorization, sign in at Microsoft

Version

6.2

Expected result

Joomla exchanges the authorization code and stores the refresh token.

Actual result

After the redirect back to Joomla:

Error code 404 received requesting access token: Not Found..

System Information

  • Joomla 6.2
  • PHP 8.4.26
  • cURL 8.14.1 / OpenSSL 3.5.7
  • Shared hosting, no proxy configured

Additional Comments

The configuration is correct (tenant ID verified, authorization works). The problem is in the HTTP request itself. I tested the token endpoint from the same server with plain PHP:

Request Result
cURL default (TLS 1.3 + ALPN) 404
cURL with CURLOPT_SSL_ENABLE_ALPN => false OK (400 AADSTS900144 as expected for a dummy request)
cURL limited to TLS 1.2 OK
PHP stream wrapper (no cURL) OK
Same URL in a browser OK
  • Same result over IPv4 and IPv6
  • Certificate is the genuine Microsoft certificate (DigiCert), so no TLS interception
  • Also affects a plain GET of /.well-known/openid-configuration

So with this cURL/OpenSSL combination, Microsoft's login endpoint answers 404 whenever ALPN is offered over TLS 1.3. As OpenSSL 3.5 becomes more common on hosting servers, other sites will likely run into this.

Workaround (confirmed working, token received and test mail delivered): add the cURL option to both OAuth2 clients:

  • administrator/components/com_config/src/Controller/MailController.php → createOAuth2Client()
  • libraries/src/Mail/MailOAuth2TokenProvider.php → requestAccessToken()
'transport.curl' => [\CURLOPT_SSL_ENABLE_ALPN => false],

Suggestion: Since the token requests only need HTTP/1.1, disabling ALPN for these two requests (or retrying without ALPN on failure) should be safe and would make the feature work on affected servers without core hacks.

avatar neoman666 neoman666 - open - 14 Oct 2026
avatar neoman666 neoman666 - change - 14 Oct 2026
Labels Added: bug
avatar neoman666 neoman666 - labeled - 14 Oct 2026
avatar joomla-cms-bot joomla-cms-bot - change - 14 Oct 2026
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 14 Oct 2026
avatar HLeithner
HLeithner - comment - 14 Oct 2026

Hi,

thanks for the information, I'm not sure where the problem really sits. The redirect from microsoft to your page should not affect any curl implementation. since the browser does the redirect.
Maybe I missed something.

avatar neoman666
neoman666 - comment - 14 Oct 2026

Hi,

thanks for looking into it! Sorry, I should have been clearer: the redirect itself works fine.

The failing step is the server-side token exchange that happens right after the redirect: Joomla receives the code and then calls $oauth2->authenticate() in MailController::oauth2callback(), which sends a POST request from the web server to the Microsoft token endpoint using the cURL transport of joomla/http. This request gets an HTTP 404 from Microsoft.

The same applies later to MailOAuth2TokenProvider::requestAccessToken(), which refreshes the access token via cURL whenever a mail is sent.

It can be reproduced without Joomla on the affected server (PHP 8.4.26, cURL 8.14.1, OpenSSL 3.5.7):

$url = 'https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration';

// 1) cURL defaults (TLS 1.3 + ALPN) -> 404
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL; // 404

// 2) Same request with ALPN disabled -> 200
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_ENABLE_ALPN, false);
curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL; // 200
avatar neoman666
neoman666 - comment - 15 Oct 2026

Some additional information that may help to assess the impact:

Hosting provider: IONOS (web hosting package)

  • PHP 8.4.26
  • cURL 8.14.1
  • OpenSSL 3.5.7
  • No proxy configured (HTTP(S)_PROXY / ALL_PROXY not set)

As IONOS is one of the largest hosting providers in Germany and Europe, I assume that a considerable number of Joomla sites could run into this as soon as they try the new SMTP OAuth2 feature with Microsoft 365.

Further findings from my tests on this server:

  • Every request from PHP-cURL to login.microsoftonline.com fails with 404 NotFound when ALPN is offered over TLS 1.3. This includes the public /.well-known/openid-configuration endpoint, not only the token endpoint.
  • The TLS certificate is the genuine Microsoft certificate (CN stamp2.login.microsoftonline.com, issued by DigiCert), so there is no TLS interception.
  • A raw TLS socket request via PHP streams (stream_socket_client) to the same endpoint returns 200 OK with the usual Microsoft headers (x-ms-request-id, x-ms-ests-server).
  • The behaviour is identical over IPv4 and IPv6 and across several Microsoft IPs.
Variant Result
cURL default (TLS 1.3 + ALPN) 404
cURL, CURLOPT_SSL_ENABLE_ALPN => false OK
cURL, max. TLS 1.2 OK
PHP stream wrapper OK

Impact for users: Without a fix, the feature fails at the token exchange with only Error code 404 received requesting access token: Not Found... Nothing is written to the Joomla log, so it is very hard for site owners to find the cause. They will probably assume a misconfiguration in Microsoft Entra.

As this most likely affects several hosting providers with a similar cURL/OpenSSL stack, I think it should be solved in Joomla core rather than per hoster. Disabling ALPN for the two OAuth2 token requests would make the feature work on such servers. The workaround from my first post has been running in production without problems since then.

avatar HLeithner
HLeithner - comment - 15 Oct 2026

On question, is this shared hosting or a server with Debian?

avatar HLeithner
HLeithner - comment - 15 Oct 2026

One question, is this shared hosting or a server with Debian?

avatar neoman666
neoman666 - comment - 15 Oct 2026

It's IONOS shared hosting (no root access), but I have SSH access and could check the system. PHP's php_uname() is masked by the hoster, the real values are:

  • OS: Debian GNU/Linux 13 (trixie), 13.7
  • cURL: 8.14.1, Debian package 8.14.1-2+deb13u5
  • OpenSSL: 3.5.7
  • PHP (web): 8.4.26

So this is not a custom build of the hoster, but the stock Debian 13 stack.

I could also reproduce the problem with the plain command line cURL, without PHP and without Joomla:

URL=https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration
curl -s -o /dev/null -w "Default:   %{http_code}\n" $URL
curl -s -o /dev/null -w "No ALPN:   %{http_code}\n" --no-alpn $URL
curl -s -o /dev/null -w "TLS 1.2:   %{http_code}\n" --tls-max 1.2 $URL

Result:

Default:   404
No ALPN:   200
TLS 1.2:   200

This means that any server running Debian 13 with the default packages is most likely affected, regardless of the hosting provider. As Debian 13 is the current stable release, the number of affected sites will grow as hosters upgrade.

Anyone with a Debian 13 system can verify this with the three commands above.

avatar HLeithner
HLeithner - comment - 16 Oct 2026

Interesting, I got another report of ionos unmanage debian trixie oauth authentication independent from the smtp thing.

On the other side I wrote the oauth implementation an debian trixie, I mean it's a custom compiled apache and php with bleeding edge curl version. So maybe it's a debian curl issue default setting.

But finally it's a Microsoft issue, at least that's my conclusion?! Anyway I'm discussing this with Maintainers.

thanks again for your help

avatar neoman666
neoman666 - comment - 20 Oct 2026

Thanks a lot for looking into this and for discussing it with the maintainers!

I agree that the root cause is most likely on Microsoft's side (or in the interaction with the Debian curl/OpenSSL defaults). From a user's perspective, though, neither side can be changed: on shared hosting there is no way to modify curl, and Microsoft probably won't react quickly.

So a small workaround in core (disabling ALPN for the two token requests) would still be very helpful, especially as more hosters move to Debian 13. I'm happy to test a PR on an affected IONOS server.

avatar HLeithner
HLeithner - comment - 20 Oct 2026

I will create PR to disable alpn, not sure yet if for all connections or only Microsoft...

Add a Comment

Login with GitHub to post a comment