Spring Boot, Java, Programming, Technology, 2fa.
@GetMapping("/generate-totp") public ResponseEntity<String> generateTotp(@RequestParam String username) { String secret = userService.findSecretByUsername(username); // Retrieve the user's secret key String totp = totpGeneratorService.generateTotp(secret); return ResponseEntity.ok(totp); } }