Is the return type the same? Or should it be:
'redirect_uri' => Url::fromRoute('phpmailer_oauth2.settings')->setAbsolute()->toString(TRUE)->getGeneratedUrl()
Using getGeneratedUrl() is correct after all. Problem was the route should be phpmailer_oauth2.aad_callback, not phpmailer_oauth2.settings.
As it stands, it does not insert a redirect_url into the response at all, which works if the Azure app has only one Redirect URI.
Is the return type the same? Or should it be:
'redirect_uri' => Url::fromRoute('phpmailer_oauth2.settings')->setAbsolute()->toString(TRUE)->getGeneratedUrl()
toString(TRUE) returns a genreatedURL type, appending getGeneratedUrl() will return a string.
NB, the previous version (before the change in #3316295), after this patch also works. (Drupal 9.5, PHP 8.1)
With redirect_uri' => Url::fromRoute('phpmailer_oauth2.settings')->setAbsolute()->toString(TRUE)->getGeneratedUrl()
, Azure returns an error because /admin/config/system/phpmailer-oauth2 is not the callback url defined in the Azure app.
Patch to the above effect.
frymorgan β created an issue.