Hi Everyone!
I'm looking for some help. I have an API over HTTPS that requires POST at login, from there you can use either the security cookie or token supplied in the returned JSON. My issue is with the next GET, POST, PUT, or DELETE request. I turned on debugging and reviewed the log, I don't think the API likes setAuth or setOption. The website's directions are very specific about what needs to be supplied in the header.
After logging in, all subsequent requests require -H Authorization and -H Content-Type. For example,
curl -X GET -H "Authorization: MY_TOKEN_ AT_LOGIN_OR_SEC_COOKIE" -H "Content-Type: application/json"
'https://mywebsite.com/Projects/api/gets ... =something'
How do you regurgitate Auth and Content in the header of requests?
Thank you,
Brian
Authentication on GET help
-
- Site Admin
- Posts: 658
- Joined: Sun Jul 04, 2021 5:12 am
Re: Authentication on GET help
You can specify the content-type in the "content-type" parameter. Please don't try to supply it manually.
The authorization header you are using is non-standard (it does not conform with the internet standards for HTTP). So you will not be able to use setAuth or setOption to set it. You can do it with an "additional header exit point" like this:
Before calling the URL:
During all subsequent HTTP requests, it will call a subprocedure named BriansHeaders that should look like this:
The authorization header you are using is non-standard (it does not conform with the internet standards for HTTP). So you will not be able to use setAuth or setOption to set it. You can do it with an "additional header exit point" like this:
Before calling the URL:
Code: Select all
http_xproc( HTTP_POINT_ADDL_HEADER
: %paddr(BriansHeaders) );
Code: Select all
P BriansHeaders B
D BriansHeaders PI
D Header 1024A varying
D UserData * value
/free
Header = 'Authorization: ' + VARIABLE_WITH_TOKEN_OR_COOKIE + x'0d25';
/end-free
P E
Re: Authentication on GET help
Hi Scott,
The http_xproc worked great!
Thank you so much!!
Brian
The http_xproc worked great!
Thank you so much!!
Brian