Проблема запроса с кодом состояния 500 при выполнении авторизацииJAVA

Программисты JAVA общаются здесь
Anonymous
Проблема запроса с кодом состояния 500 при выполнении авторизации

Сообщение Anonymous »

Добрый вечер всем, надеюсь, это сообщение находит вас хорошо! Интересно, должны ли какие -либо изменения необходимо внести в следующие строки кода, когда он возвращает следующие исключения (приведенные в выходе). Ваша поддержка высоко ценится.public interface AuthService {
@PostMapping(
value = "/oauth/token",
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
// consumes = {"application/x-www-form-urlencoded"},
produces = MediaType.APPLICATION_JSON_VALUE
// produces = {"application/json"}
)
LoginResponse authenticate(
@RequestParam(name = "grant_type") String grantType,
@RequestParam String username,
@RequestParam String password,
@RequestBody String reqBody
);
}
< /code>
output: < /p>
[AuthService#authenticate(String, String, String, String)]:
[
{
"error": "invalid_request",
"error_description": "Missing form parameter: grant_type"
}
]
with root cause feign.FeignException$BadRequest: [400 Bad Request] during [POST]
< /code>
попробовал следующие несколько параметров, чтобы решить проблему. Но не повезло. Ваше руководство высоко ценятся.14:53:16.258 [http-nio-8090-exec-2] ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet] -
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
[Request processing failed; nested exception is feign.FeignException$BadRequest:
[400 Bad Request] during [POST] to https call [AuthService#authenticate(String,String,String,String)]:
[
{
"error": "invalid_request",
"error_description": "Missing form parameter: grant_type"
}
]
]
with root cause
feign.FeignException$BadRequest: [400 Bad Request] during [POST] to https call [AuthService#authenticate(String,String,String,String)]:
[
{
"error": "invalid_request",
"error_description": "Missing form parameter: grant_type"
}
]

option2:
vasevations: попробовал следующее, чтобы решить проблему Grant_type . Но не повезло: < /p>
@PostMapping(
value = "/oauth/token",
// consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
consumes = {"application/x-www-form-urlencoded"},
// produces = MediaType.APPLICATION_JSON_VALUE,
produces = {"application/json"}
)
< /code>
output: < /p>
02:29:32.547 [http-nio-8090-exec-4] ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet] -
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
[Request processing failed; nested exception is feign.FeignException$BadRequest:
[400 Bad Request] during [POST] to [https]:
[
{
"error": "invalid_request",
"error_description": "Missing form parameter: grant_type"
}
]
] with root cause
feign.FeignException$BadRequest: [400 Bad Request] during [POST] to [https:] [AuthService#authenticate(String,String,String,String)]:
[
{
"error": "invalid_request",
"error_description": "Missing form parameter: grant_type"
}
]
at feign.FeignException.clientErrorStatus(FeignException.java:213) ~[feign-core-11.8.jar!/:?]


Подробнее здесь: https://stackoverflow.com/questions/795 ... horization

Вернуться в «JAVA»