Pass SSOTokenID as set-cookie value in OpenAM - http

I'm using openam OAuth/OpenID for user authentication. As mentioned in the documentations, I could get SSOTokenID as a JSON object by making following HTTP request.
curl -X POST -H "X-OpenAM-Username: demo" -H "X-OpenAM-Password: changeit" -H "Content-Type: application/json" -d '' -k -v https://openam.example.com:8443/openam/json/authenticate?realm=/
Instead of that, I want to get SSOTokenID as the Set-Cookie header value of the HTTP response. Are there anyway that i can do it?

Assuming you are only using an authentication module that accepts a NameCallback and PasswordCallback (as you used in your example), then you can just use the legacy UI zero-page login , you need to disable XUI though
Using your example
curl -X POST -d 'IDToken1=demo&IDToken2=changeit' -k -v https://openam.example.com:8443/openam/UI/Login?realm=/

Related

Simulate a specific CURL using HTTP caller in FME Desktop

I am trying to simulate the following CURl using HTTP caller in FME Desktop:
$ curl -X POST --noproxy “*” -k "https://server_name/connect/token" -H "Content-Type: application/x-www-form-urlencoded" -d "username=asdfg" -d "password=ghjkl" -d "scopes=openui profile".
Where can I specify the body parameters in the HTTP caller transformation?
Thanks
I have used the authentication option to fill in the username and password.

How to send a file in a url via curl?

I have an image in a URL like https://i.postimg.cc/GpDskmSG/sdssds.png and I want to send it over to be stored at nft.storage. Could I send it directly as a URL instead of a file from a path? I tried the below but it only stores the image URL.
curl -H "Authorization: Bearer eyJhbGciOiJIwetertyrtyUzI1NiIsInR5cCI6Ikp" -H "Content-Type: image/png" --data "https://i.postimg.cc/GpDskmSG/sdssds.png" --url "https://api.nft.storage/upload"
P/S: I'm testing on windows curl.
According to the API docs (https://nft.storage/api-docs/), it will accept multipart/form-data for this type of POST.
You can try using -F/--form instead, for which a good example exists on the curl man page (https://linux.die.net/man/1/curl):
curl -F "web=#index.html;type=text/html" url.com

What does -d stand for in curl request?

I am trying to send this HTTP request in Postman application:
curl -v https://api.someurl.com/z1/lists \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: authorization" \
-d '{ "list_id": "DXVBDAD" }'
Any body knows what -d stands for? and where should I put it in Postman?
The documentation says this:
(HTTP) Sends the specified data in a POST request to the HTTP server[...]
So this will be the body of your POST request. In Postman you have to put it into the 'body' field. There select 'raw' and then select 'application/json'.
Because that's the Content-Type of your request, specified with -H.
The -d or --data option makes the curl command send data in POST request to the server. This option makes the curl command pass data to the server using content-type (JSON in your case) just as the browser does when a user submits a form.

WordPress 4.7 REST API Example Request does not work

I'm using successfully the WordPress 4.7 REST API in this way:
curl -H "Authorization: Basic mykey" -X POST --data-urlencode "title=Something" www.myhost.com/wp-json/wp/v2/posts/770
The example in the new docs suggests:
curl -X POST http://demo.wp-api.org/wp-json -d '{"title":"My New Title"}'
which obvious is a wrong endpoint. Adapting to
curl -H "Authorization: Basic mykey" -X POST www.myhost.com/wp-json/wp/v2/posts/770 --data-urlencode '{"title":"My New Title"}'
does not change the title but simply returns the post as JSON
Any idea?
Came over my own question, which I did resolve a long time ago. Just if someone struggles with this too.
First of course, posting data with curl requires the -d option an not the --data-urlencode. Second, the REST endpoint needs to know the type of data. Here JSON. So setting the correct Content Type is essential.
This is a complete example:
curl -H "Authorization: Basic mykey>" -H "Content-Type: application/json" -X POST -d '{"title":"Something"}' www.myhost.com/wp-json/wp/v2/posts/770

How do I get token from Paypal with PAW?

In the example of paypal:
curl -v https://api.sandbox.paypal.com/v1/oauth2/token \
-H "Accept: application/json" \
-H "Accept-Language: en_US" \
-u "Client ID: Secret" \
-d "grant_type=client_credentials"
But I don't know how to setting with the -u "Client ID: Secret", in PAW everything about the auth is setting with the header
To get your access token from PayPal you should authenticate using HTTP Basic Auth, set Authorization header to the Basic Auth dynamic value and set your client id and secret as input for the dynamic value.
Make sure that your request body is Form URL-Encoded :
You can also import your cURL into Paw by going to File>Import>Text and pasting cURL there (you can install cURL importer from https://luckymarmot.com/paw/extensions/cURLImporter) It will automatically create a request in Paw.

Resources