Answer the question
In order to leave comments, you need to log in
Is it correct to process the authorization code through a GET request?
Good afternoon, I'm new to this business, so please don't criticize, thanks.
I'm doing user registration through Spring Security after registration, the user receives an activation code, after which he will be redirected to the login page.
The question is, is it correct to catch a GET request via json and return json?. Is this the correct approach?
Is it correct to use @PathVariable in this case or should I use @RequestBody.
I will be glad to any answer.
@GetMapping(path = "/activate/{code}", consumes = "application/json", produces = "application/json")
public EnrichedUserDto activate(@PathVariable String code) {
EnrichedUserDto enrichedUserDto = new EnrichedUserDto();
System.out.println(isActivated + " " + "isActivate");
if (isActivated) {
enrichedUserDto.setHasError(false);
enrichedUserDto.setMessage("User successfully activated");
}else {
enrichedUserDto.setHasError(true);
enrichedUserDto.setMessage("Activation code is not found!");
}
return enrichedUserDto;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question