-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catchable Expired Tokens from Oauth #803
Comments
Do you mean it logs the error when trying to create a new If so, that code is inside the |
It is on that line, It exits, It doesn't log the error it doesn't throw a throwable error or exception it catches it internally and exits. And because of how it is caught internally i can't catch and handle to be able to tell customers that their token is invalid or expired. |
Also i have a ticket open with that team as well and have received no response. |
Could you please try pinging the issue agin? I'm afraid I cannot do anything much here, as it's outside this repository. |
@fiboknacky now they are telling me that this needs to be handled as a middleware in google ads api library? Each side is pointing fingers at the other. |
After closely looking into this, it looks like the exception isn't printed out as a log directly. The However, it's still thrown as a normal exception. try {
// Generate a refreshable OAuth2 credential for authentication.
$oAuth2Credential = (new OAuth2TokenBuilder())
->withClientId(env('GOOGLE_ADS_CLIENT_ID'))
->withClientSecret(env('GOOGLE_ADS_CLIENT_SECRET'))
->withRefreshToken($refreshToken)
->build();
} catch (ClientException $e) {
// Do something with $e.
} Could you give it a try? |
Except it's not, if you notice my code above, I'm catching \Throwable which is under \Error or \Exception the root of all throwable errors in php and it's still not being caught, this is because something upstream is catching the error before it comes to the client. |
I just tried yesterday and it worked perfectly. I don't think we have any layers that would catch |
If you look at the code in the first post, it should just fail silently, It doesn't matter if i catch |
That's the part I don't understand because as I mentioned in my previous reply, I just tried the solution I shared above and it successfully catches the exact exception you mentioned in the first post. And in the error message itself, it says that it is of the Correct me if I'm wrong. You're trying to catch this exception and do something with it, right? |
Thats just it, it's not failing silently, it's being caught earlier upstream. Even though i want to do something with it it's already caught, and handled and dumped out and exited the code. I'm currently running this in a laravel job queue, this exits the queue worker completely and dumping the error output out as listed above. I'm not asking it to, it just is. |
I see. I think the best way to test would be modifying one of our code examples to include catching of And would it be possible to test using |
Closing due to inactivity. Feel free to reopen this if you still face the issue. |
Your client library and Google Ads API versions:
v15.0
10
Your environment:
rest
Description of the bug:
We have a need to be able to catch, and handle when a refresh token comes back as invalid or expired. We need to be able to send a message off to our customers to refresh their tokens. Currently i'm not seeing a way to handle this within the initiator.
Steps to reproduce:
with the code above passing in an invalid or expired token causes guzzle to throw this error into logs, it's not catchable even with catching
\Throwable
The text was updated successfully, but these errors were encountered: