Closed (fixed)
Project:
PHPMailer OAuth2
Version:
1.0.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Feb 2023 at 18:45 UTC
Updated:
16 Oct 2023 at 13:48 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
frymorgan commentedPatch to the above effect.
Comment #3
imclean commentedIs the return type the same? Or should it be:
'redirect_uri' => Url::fromRoute('phpmailer_oauth2.settings')->setAbsolute()->toString(TRUE)->getGeneratedUrl()Comment #4
imclean commentedComment #5
frymorgan commentedUrl::toString(TRUE) returns a GeneratedUrl object, 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.Comment #6
imclean commentedWhich is what is returned without this patch.
How does adding "TRUE" fix the error? It's the same (incorrect?) route being returned, just as a GeneratedUrl object instead of a string.
Comment #7
nathan tsai commentedIncreasing the priority of this issue to "Major" because the module is currently unusable without a workaround.
I got the same error as above, but applying the patch allowed me to successfully generate the tokens:
I have no clue why returning a GeneratedUrl fixes the bug, though, hence the "Needs Review" status.
@frymorgan, perhaps you can speak more about this issue?
Comment #9
imclean commentedI don't fully understand why as we've used this module in the past without it. That said, it works for at least 2 people so I've committed it.
Comment #11
frymorgan commentedUsing 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.