Sending JWT token in the headers with Postman

后端 未结 12 1802
借酒劲吻你
借酒劲吻你 2020-12-07 07:38

I\'m testing an implementation of JWT Token based security based off the following article. I have successfully received a token from the test server. I can\'t figure out ho

12条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-07 07:55

    I did as how moplin mentioned .But in my case service send the JWT in response headers ,as a value under the key "Authorization".

    Authorization →Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJpbWFsIiwiZXhwIjoxNDk4OTIwOTEyfQ.dYEbf4x5TGr_kTtwywKPI2S-xYhsp5RIIBdOa_wl9soqaFkUUKfy73kaMAv_c-6cxTAqBwtskOfr-Gm3QI0gpQ
    

    What I did was ,make a Global variable in postman as

    key->jwt
    value->blahblah

    in login request->Tests Tab, add

    postman.clearGlobalVariable("jwt");
    postman.setGlobalVariable("jwt", postman.getResponseHeader("Authorization"));
    

    in other requests select the Headers tab and give

    key->Authorization

    value->{{jwt}}

提交回复
热议问题