Spring Security OAuth2 认证失败的格式如下 { "error": "unsupported_grant_type", "error_description": "Unsupported grant type: refresh_token1" } 这个返回是很不友好的,特别是在前后端分离的时候,前端一般是根据我们的返回码进行处理,所以我们还得自定义我们的异常处理 在 AuthorizationServerEndpointsConfigurer端点配置类有一个 WebResponseExceptionTranslator异常转换器。 WebResponseExceptionTranslator只有一个translate方法,很明显,这个方法就是用来转换异常的 public interface WebResponseExceptionTranslator<T> { ResponseEntity<T> translate(Exception e) throws Exception; }...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with Result
Contact Result, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack