refreshToken method
Implementation
Future<void> refreshToken() async {
if (authenticator == null) {
throw Exception('No authenticator provided');
}
final userCredentials = await storage.getCredentials();
final tokens = await authenticator?.refresh(baseUrl, userCredentials!.refreshToken);
if (tokens == null) {
throw Exception('Failed to refresh token');
}
// set token in storage
await storage.setCredentials(tokens);
}