Programming/node.js2018. 10. 26. 19:30

JWT 사용시 cURL을 통해서 해당 JWT 인증 정보를 받는법 찾는중

GET /resource HTTP/1.1

Host: server.example.com

Authorization: Bearer eyJhbGciOiJIUzI1NiIXVCJ9...TJVA95OrM7E20RMHrHDcEfxjoYZgeFONFh7HgQ 

[링크 : https://stackoverflow.com/questions/33265812/best-http-authorization-header-type-for-jwt]


TOKEN=$(curl -s -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' --data '{"username":"{username}","password":"{password}","rememberMe":false}' https://{hostname}/api/authenticate | jq -r '.id_token')


curl -H 'Accept: application/json' -H "Authorization: Bearer ${TOKEN}" https://{hostname}/api/myresource 

[링크 : https://medium.com/@nieldw/using-curl-to-authenticate-with-jwt-bearer-tokens-55b7fac506bd]


조금 헷갈리는데.. 인증 값으로 이전에 돌려받은 id_token을 쓰면 된다는건가?(bearer로 받아오는)

Posted by 구차니