我正在尝试使用 Spring Boot rest api 设置 oauth,但我遇到了一些问题。
当我尝试通过 /auth/token 获取访问令牌时,我要么得到 405 - Method Not Allowed:
或者来自基本 url (localhost:8080/) 的响应,这是一个简单的 json:
第一个发生在我没有在 EntryController 中定义 PostMapping 时,另一个发生在我设置它时。
我还可以在日志中看到:
2018-09-10 22:03:16.011 INFO 78436 --- [on(3)-127.0.0.1] .s.o.p.e.FrameworkEndpointHandlerMapping : Mapped "{[/oauth/token],methods=[GET]}" onto public org.springframework.http.ResponseEntity<org.springframework.security.oauth2.common.OAuth2AccessToken> org.springframework.security.oauth2.provider.endpoint.TokenEndpoint.getAccessToken(java.security.Principal,java.util.Map<java.lang.String, java.lang.String>) throws org.springframework.web.HttpRequestMethodNotSupportedException
2018-09-10 22:03:16.012 INFO 78436 --- [on(3)-127.0.0.1] .s.o.p.e.FrameworkEndpointHandlerMapping : Mapped "{[/oauth/token],methods=[POST]}" onto public org.springframework.http.ResponseEntity<org.springframework.security.oauth2.common.OAuth2AccessToken> org.springframework.security.oauth2.provider.endpoint.TokenEndpoint.postAccessToken(java.security.Principal,java.util.Map<java.lang.String, java.lang.String>) throws org.springframework.web.HttpRequestMethodNotSupportedException
我已经尝试了一切,但没有成功。
这是我目前拥有的代码:
天涯尽头无女友
相关分类