- Issue created by @lav rai
- Status changed to Postponed: needs info
over 1 year ago 6:54pm 16 May 2023 - 🇺🇸United States mglaman WI, USA
What is the exact error? This is just a class and method name.
- 🇺🇸United States capysara
I'm getting
TypeError: Drupal\acquia_dam\AcquiadamAuthService::refreshAccessToken(): Argument #1 ($refresh_token) must be of type string, null given, called in /app/docroot/modules/contrib/acquia_dam/src/Client/AcquiaDamClientFactory.php on line 175 in Drupal\acquia_dam\AcquiadamAuthService->refreshAccessToken() (line 309 of /app/docroot/modules/contrib/acquia_dam/src/AcquiadamAuthService.php)
- Merge request !14#3360415 – Check for user token before attempting to refresh → (Open) created by capysara
- last update
over 1 year ago 196 pass, 2 fail - 🇺🇸United States capysara
I'm hitting that error because I'm having issues connecting today. I made a MR that checks to be sure that the user has a token. After I add that, I'm still not able to connect, but I get directed to my media library and there's a message:
Something went wrong contacting Acquia DAM, the search could not be completed.
- Status changed to Needs review
over 1 year ago 3:41pm 23 May 2023 - 🇺🇸United States mglaman WI, USA
Thanks for helping explain the error, this seems reasonable if it's a type error.
- last update
over 1 year ago 199 pass - last update
over 1 year ago 199 pass - last update
over 1 year ago 199 pass - 🇺🇸United States capysara
Updated the MR. Is that the right fix for this?
I also added the check to getRefreshToken and removed "?" from "?string" because it shouldn't return null. - Assigned to mglaman
- 🇺🇸United States mglaman WI, USA
That looks right! Thank you for making the fix. This is in our sprint right now, so I'll review it and get it committed.
- 🇺🇸United States mglaman WI, USA
Yep, this looks great. It fixes passing null to
\Drupal\acquia_dam\AcquiadamAuthService::refreshAccessToken
and removesnull|string
from those two methods.But now I'm concerned that the OAuth refresh middleware is running when it isn't supposed to, and that's why we saw this bug.
- 🇺🇸United States mglaman WI, USA
The error lies here:
if (!$value instanceof ResponseInterface) { return $value; } if ($value->getStatusCode() !== 401) { return $value; }
We can get a 401 unauthorized request before the site is configured. The code doesn't check
auth_type
. It assumes a refresh token should be used on 401. - last update
over 1 year ago 196 pass, 2 fail - last update
over 1 year ago 199 pass - Issue was unassigned.
- Status changed to Fixed
over 1 year ago 6:23pm 30 May 2023 - 🇺🇸United States mglaman WI, USA
Merged! We'll have a release soon with the fix. Thanks @capysara.
Automatically closed - issue fixed for 2 weeks with no activity.