token method
Implementation
@override
Future<String> token() async {
final access = _access;
if (access != null && _accessExpiry.difference(DateTime.now()) > const Duration(seconds: 30)) {
return access;
}
final refresh = await _store.read(_refreshKey);
if (refresh == null) {
throw StateError('Not signed in — run the PKCE flow and call exchange() first.');
}
return _postToken({
'grant_type': 'refresh_token',
'refresh_token': refresh,
'client_id': config.clientId,
});
}