validate function
Checks if given accessToken
and clientToken
are still valid.
clientToken
is optional, though if provided should match the client token
that was used to obtained given accessToken
.
Implementation
Future<bool> validate(AccessToken accessToken, {String? clientToken}) async {
final headers = {
'content-type': 'application/json',
};
final payload = {
'accessToken': accessToken,
};
if (clientToken != null) {
payload.putIfAbsent('clientToken', () => clientToken);
}
final response = await requestBody(
http.post, _authServerApi, 'validate', payload,
headers: headers);
return response.statusCode == 204;
}