Where XXXXXXXXXXXXXXXX is the Base64 encoding of "admin:myarraypassword"
I know that I need to get the EMC-CSRF-TOKEN/Ticket granting cookie but was expecting to get this with the first GET request I do - should I be using a different URL to do this initial authorization, or does any GET to a valid URL work?
I've seen perl and python examples, but as I am not familiar with either of these 2 languages, then this doesn't help me much.
Thanks Greg, provided I tell curl to write a cookie, with the -L option I'm now getting a good response, and if I then tell curl to use this cookie for subsequent commands I don't need to use the "-H "Authorization:Basic XXXXXXXXXXXXXXXX" option so I can get on with my automation - many thanks.
Just in case this is of use to anyone else, the above is OK for GET commands, but POST/DELETE gets a bit more complicated. In theory it's just a case of grabbing the EMC-CSRF-TOKEN on the first GET after the login, but unless the cookie curl uses is updated as part of this initial GET, with MOD_AUTH_CAS_S then EMC-CSRF-TOKEN changes on every subsequent GET.
Please remember to mark your question Answered when you get the correct answer and award points to the person providing the answer. This helps others searching for a similar issue. In the case of this particular question, making the Question Answered will help others looking for similar questions about Curl.
After another tweak of the user account, and using -L in the curl command, I keep getting a whole bunch of 302's getting returned. Not sure whats happening here???
* Mark bundle as not supporting multiuse < HTTP/1.1 302 Found < Date: Tue, 12 Oct 2021 03:40:22 GMT < Server: Apache < X-Frame-Options: SAMEORIGIN < Strict-Transport-Security: max-age=63072000; includeSubdomains; < Set-Cookie: MOD_AUTH_CAS_S=aed4093f7bee0d2ead066509f5caa0ada3046770;Secure;Path=/; HttpOnly < Location: https:// /api < Content-Length: 209 < Content-Type: text/html; charset=iso-8859-1 < * Ignoring the response-body * Connection #0 to host left intact * Maximum (50) redirects followed curl: (47) Maximum (50) redirects followed
mattdulson
4 Posts
10655
0
Posted May 8th, 2017 01:00
Thanks Greg, provided I tell curl to write a cookie, with the -L option I'm now getting a good response, and if I then tell curl to use this cookie for subsequent commands I don't need to use the "-H "Authorization:Basic XXXXXXXXXXXXXXXX" option so I can get on with my automation - many thanks.
Matt