clearAuthCache method

Future<void> clearAuthCache()

Clears any client side cache that might be holding invalid tokens.

If client runs into 401 errors using a token, it is expected to call this method and grab authHeaders once again.

Implementation

Future<void> clearAuthCache() async {
  final String? token = (await authentication).accessToken;
  // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter.
  // https://github.com/flutter/flutter/issues/26431
  // ignore: strong_mode_implicit_dynamic_method
  await GoogleSignIn.channel.invokeMethod(
    'clearAuthCache',
    <String, dynamic>{'token': token},
  );
}