We are developing an application using Spring boot microservices.
We have one Authentication service with oauth2 system using spring security. there we are successfully getting access_token, refresh token through oauth/token request. We have implemented user signup also in the same service.
So my question is how can generate and return access_token and refresh_token for the new registered user in the same signup request.
Anyone can help us to get the answer?
Given below is my signup method. User is successfully inserted in the database.
@RequestMapping(value = "/signup", method = RequestMethod.POST, consumes = {
MediaType.APPLICATION_JSON_VALUE }, produces = { MediaType.APPLICATION_JSON_VALUE })
public String createNewUser(@Valid @RequestBody SignUpRequest signUpDto, HttpServletRequest request,
@RequestParam(value = "roletype") String roletype, BindingResult result, HttpServletResponse response)
throws UserAlreadyExistAuthenticationException {
userService.registerNewUser(signUpDto, roletype);
try {
} catch (Exception e) {
System.out.println(e);
}
return "success";
}