spring security - Cookie request using R -
i'm trying convert following curl command httr/rcurl cookie r. i'm not sure how pass data "j_username=username&j_password=password" using geturl(...) or get(...)
curl --data "j_username=username&j_password=password" http://localhost:8080/myapp/j_spring_security_check --cookie-jar cookies.txt
i'm able cookie information created command line curl command above , paste request (it works). if generate cookie within r convenient.
here's working httr get():
get(dataurl, verbose(), add_headers("content-type"="application/json", "accept"="application/json", "accept-version"=" 1.0", "cookie"="jsessionid=24ba7a80a02317ad2b6c87c8d10b6787" ) )
it's hard tell without reproducible example, think httr code want this:
library(httr) baseurl <- "http://localhost:8080/myapp/" post(baseurl, path = "j_spring_security_check", body = list(j_username = "username", j_password = "password"), multipart = false, verbose() ) headers <- add_headers( "content-type" = "application/json", accept = "application/json", "accept-version" = "1.0" ) get(baseurl, headers, verbose())
httr automatically sets handle preserve cookies within domain.
Comments
Post a Comment