invalidateTokenWithStrategy method
Invalidates tokens using a specific strategy
token The access token
logoutType The type of logout strategy to use
Implementation
@override
Future<void> invalidateTokenWithStrategy(
String token,
LogoutType logoutType,
) async {
final strategy = _strategyFactory.createStrategy(logoutType);
// Get token info to create context
final tokenRecord = await _tokenService.findToken(token);
if (tokenRecord == null) {
throw AuthException('Invalid token');
}
final userId = tokenRecord['tokenable_id'];
final context = TokenInvalidationContext.fromTokens(
accessToken: token,
userId: userId,
guard: _providerKey,
);
await strategy.invalidateTokens(context);
}