faithoflifedev / google_vision_workspace

Integrates Google Vision features, including image labeling, face, logo, and landmark detection, optical character recognition (OCR), and detection of explicit content, into applications.
MIT License
20 stars 8 forks source link

Token expiry not handled properly #15

Closed arjanmels closed 10 months ago

arjanmels commented 1 year ago

I got a "Unhandled Exception: DioException [bad response]: The request returned an invalid status code of 401". Due to the token being expired.

As a workaround I refresh the entire GoogleVision object, but I think this should be handled in the class itself. (The infrastructure seems in place with the tokenExpired field, but it is not checked before making actual requests.)

faithoflifedev commented 1 year ago

Thanks for the feedback @arjanmels, I've made some code changes as an attempt to resolve this. Do you have some sample code I could use to test against?

arjanmels commented 1 year ago

Sample code: wait > 1h (the default OAuth expiry time) between creation of GoogleVision and the call of detect. (I happened to stumble upon it, because I had a debug session running in flutter, which took >1h.)