These are chat archives for alvarosanchez/spring-security-rest

7th
Jul 2015
Ejaz Ahmed
@ejaz-ahmed
Jul 07 2015 05:41
Hey guys, I am trying @Álvaros greach2014 repo to get know how of plugin. I am able to generate authentication token using this
curl -i -H "Content-Type: application/json" -d '{"username":"jimi","password":"jimispassword"}' http://localhost:8080/restful-grails-springsecurity-greach2014/api/login -H "Accept: application/json"
When I sent GET request with token as X-Auth-Token header using cURL, I am redirected to login page again
I am using Alvaros repo as is without any change
Here is my cURL command and its response
curl -X GET -i -H "X-Auth-Token: 1eprcpl6u88thjd98ct7016lh4409cuS" -H "Accept: application/json" http://localhost:8080/restful-grails-springsecurity-greach2014/categories
HTTP/1.1 302 Found
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=9241EBF1B3DD4A070A751E35031AF641; Path=/restful-grails-springsecurity-greach2014/; HttpOnly
Location: http://localhost:8080/restful-grails-springsecurity-greach2014/login/auth
Content-Length: 0
Date: Tue, 07 Jul 2015 05:43:38 GMT
Lawrence Lee
@ChaosWars
Jul 07 2015 14:45
You need to send it as a header
"Authorization: Bearer <token>"
Not as X-Auth-Token
curl -X GET -i -H "Authorization: Bearer 1eprcpl6u88thjd98ct7016lh4409cuS" -H "Accept: application/json" http://localhost:8080/restful-grails-springsecurity-greach2014/categories