2016-03-25 4 views
0

ich auf dem folgende Beispiel, um basierend habe ein sicheres REST-API zu erstellen: https://github.com/royclarkson/spring-rest-service-oauthBadRequest auf modifizierten Feder OAuth2 Beispiel royclarkson Github

Das Problem ist, dass wenn ich versuche, das Token zu bekommen ich immer Bad Credentials Fehler.

Der Code ist gleich, also meine Vermutung ist, dass ich die Access Token Abfrage nicht richtig mache. Folgende ist meine Locke:

C:\Users\Javier\Desktop\curl\bin>curl -X POST -vu clientapp:123456 http://localhost:8080/wombee/oauth/token -H "Accept: application/json" -d "password=javi&username=javi&grant_type=password&scope=read%20write&client_secret=123456&client_id=clientapp" 
Note: Unnecessary use of -X or --request, POST is already inferred. 
* Trying ::1... 
* Connected to localhost (::1) port 8080 (#0) 
* Server auth using Basic with user 'clientapp' 
> POST /wombee/oauth/token HTTP/1.1 
> Host: localhost:8080 
> Authorization: Basic Y2xpZW50YXBwOjEyMzQ1Ng== 
> User-Agent: curl/7.47.1 
> Accept: application/json 
> Content-Length: 107 
> Content-Type: application/x-www-form-urlencoded 
> 
* upload completely sent off: 107 out of 107 bytes 
< HTTP/1.1 400 Petición incorrecta 
< Server: Apache-Coyote/1.1 
< X-Content-Type-Options: nosniff 
< X-XSS-Protection: 1; mode=block 
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate 
< Pragma: no-cache 
< Expires: 0 
< X-Frame-Options: DENY 
< Cache-Control: no-store 
< Pragma: no-cache 
< Content-Type: application/json;charset=UTF-8 
< Transfer-Encoding: chunked 
< Date: Fri, 25 Mar 2016 10:52:01 GMT 
< Connection: close 
< 
{"error":"invalid_grant","error_description":"Bad credentials"}* Closing connection 0 

Antwort

0

Dumme mich, in CustomUserDetailsService ich mit einem Null-getPassword Methode überschreiben hatte, das war mein Problem.