I'm trying to find a solution for getting a new Refresh Token after the existing one has expired.
The Google APIs Client Library for .NET Developer's Guide provides this hint:
Both
UserCredential
andServiceAccountCredential
implementIConfigurableHttpClientInitializer
so you can register each of these as:
- An unsuccessful response handler, so it will refresh the token if it receives an HTTP 401 status code.
- An interceptor, to intercept the Authorization header on every request.
Did anybody figure out how to register UserCredential
as an unsuccessful response handler and make it handle the 401s automatically?