django - Error decodin signature JWT authentication Android -
i'm using django rest_framework , activated jsonwebtokenauthentication . seems work fine when post login user token. if validate token in jwt.io signature validated. when send or post endpoint in server , in header put "authorization: jwt " following.
06-26 12:20:58.832 5293-7833/com.infortec.angel.montalbanwebser d/retrofit﹕ authorization: jwt {token:<token>} 06-26 12:20:58.842 5293-7833/com.infortec.angel.montalbanwebser d/retrofit﹕ ---> end http (no body) 06-26 12:20:59.322 5293-7833/com.infortec.angel.montalbanwebser d/retrofit﹕ : http/1.0 403 forbidden 06-26 12:20:59.332 5293-7833/com.infortec.angel.montalbanwebser d/retrofit﹕ allow: get, post, head, options 06-26 12:20:59.332 5293-7833/com.infortec.angel.montalbanwebser d/retrofit﹕ content-type: application/json 06-26 12:20:59.332 5293-7833/com.infortec.angel.montalbanwebser d/retrofit﹕ date: fri, 26 jun 2015 10:19:34 gmt 06-26 12:20:59.332 5293-7833/com.infortec.angel.montalbanwebser d/retrofit﹕ server: wsgiserver/0.1 python/2.7.3 06-26 12:20:59.332 5293-7833/com.infortec.angel.montalbanwebser d/retrofit﹕ vary: accept, cookie 06-26 12:20:59.332 5293-7833/com.infortec.angel.montalbanwebser d/retrofit﹕ x-android-received-millis: 1435314059321 06-26 12:20:59.332 5293-7833/com.infortec.angel.montalbanwebser d/retrofit﹕ x-android-response-source: network 403 06-26 12:20:59.332 5293-7833/com.infortec.angel.montalbanwebser d/retrofit﹕ x-android-selected-transport: http/1.1 06-26 12:20:59.332 5293-7833/com.infortec.angel.montalbanwebser d/retrofit﹕ x-android-sent-millis: 1435314059296 06-26 12:20:59.332 5293-7833/com.infortec.angel.montalbanwebser d/retrofit﹕ x-frame-options: sameorigin 06-26 12:20:59.342 5293-7833/com.infortec.angel.montalbanwebser d/retrofit﹕ {"detail":"error decoding signature."} 06-26 12:20:59.342 5293-7833/com.infortec.angel.montalbanwebser d/retrofit﹕ <--- end http (38-byte body)
{"detail":"error decoding signature."}
edit: i'm using requestinterceptor add header.
public class tokenrequestinterceptor implements requestinterceptor{ @override public void intercept(requestfacade request) { request.addheader("content-type", "application/json"); request.addheader("authorization", "jwt " + utils.token); } }
utils.token static field store token when retrieve server after authentication.
d/retrofit﹕ authorization: jwt {token:<token>}
i think problem you're sending token json object instead of sending token itself:
d/retrofit﹕ authorization: jwt <token>
if send token json should send in body instead in authorization header.
$ curl -x post -h "content-type: application/json" -d '{"token":"<token>"}' url
Comments
Post a Comment