How do I get token from Paypal with PAW? - paw-app

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.

Related

How do I access Firestore using CURL with an API Key and service account token?

I am trying to access my Firestore database using cURL from a terminal session. I have read through the REST API documentation for Firestore and the Authentication documentation for authenticating Oauth and services accounts. I have set up a services accounts and IAM roles in API dashboard. I cannot determine from the documentation what the correct path and syntax and what do use for the API Key and the BEARER token. For example, I am trying to receive a json response for the USER xyz, document field FNAME that is stored in a Firestore DATABASE (note - where do i find the the databaseID?) that is in PROJECT testproject.
Here is the CURL command lists in the documentation -
curl \
'https://firestore.googleapis.com/v1beta1/%5BNAME%5D?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
curl --request POST \
'https://firestore.googleapis.com/v1beta2/%5BNAME%5D:exportDocuments?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{}' \
--compressed
Questions are - what do I use for the [YOUR_API_KEY] ?
What do I use for the [YOUR ACCESS TOKEN] -
I have tried the following from credentials for a Service account that I set up
Service account - Key - 3......................e76
Unique ID - 1............39
for the API KEY and the ACCESS TOKEN and get a 403 error back
I also have a Oauth credentials -
Client ID - 2.....113-95.......cpqrarqb.....qnrpc.apps.googleusercontent.com
Client Secret - L......lq
PATH
https://firestore.googleapis.com/v1/projects/{project_id}/databases/{database_id}/collectionGroups/{collectionId}/fields/{field_id}
Which didn't work either...
Again, I am trying to access and read and write data to my Firestore database using CURL - as a proxy for what will be my REST API's. Any help and assistance much appreciated.
From the curl commands you have pasted I understand that you want to export your firestore collections to a Cloud Storage bucket. Furthermore I understand you obtained the curl commands from the api explorer of the exports method.
To provide an api key value to [YOUR_API_KEY], you first need to create an api key in your GCP project; here is the process:
Go to the credentials section.
Click on the option at the top called 'Create Credentials'.
Select API key.
Copy and keep safe the value thrown by the Cloud Console (this is your api key).
If you want to know more about API keys, you can visit this.
To provide an oauth token value, you can do the following:
You can open Cloud Shell.
Run command gcloud auth application-default print-access-token.
Copy and keep safe the value thrown by Cloud Shell (this is your oauth token).
Please note that there are several ways to create an oauth token but the one I specified is the fastest one. You may also use the oauth playground to generate your token; keep in mind that the token is valid for 60 minutes.
As per the database id I have used (default) and here I include my curl statement:
curl --request POST \
'https://firestore.googleapis.com/v1/projects/[PROJECT_ID]/databases/(default):exportDocuments?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"collectionIds":["users"],"outputUriPrefix":"gs://[BUCKET_PATH]"}' \
--compressed

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.

Pass SSOTokenID as set-cookie value in OpenAM

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=/

external_account not accepting dictionary?

I am using stripe to update the card on a managed account external_account, but the error is asking for a token but the docs are saying wither token or dictionary.
https://stripe.com/docs/api#account_create_card
-d external_account={"object":"card", "exp_month":"04", "exp_year":"2019", "number":"5200828282828210"}
Error
{
"error": {
"type": "invalid_request_error",
"message": "Received unknown parameter: number",
"param": "number"
}
}
The reason that your example curl command doesn't work is that the Stripe API requires that the Content-Type header of requests sent to it be application/x-www-form-urlencoded and you are sending a JSON string.
curl https://api.stripe.com/v1/accounts/acct_XXYYZZ/external_accounts \
-u sk_test_AABBCC: \
-d external_account[object]="card" \
-d external_account[number]=5200828282828210 \
-d external_account[exp_month]=04 \
-d external_account[exp_year]=2019 \
-d external_account[cvc]=123
From the curl man-page, the "-d" switch on the curl command "Sends the specified data in a POST request to the HTTP server, in the same way that a browser does when a user has filled in an HTML form and presses the submit button. This will cause curl to pass the data to the server using the content-type application/x-www-form-urlencoded" which what you want, and the square bracket notation is how you send a hash/dictionary as Content-Type: application/x-www-form-urlencoded.

Fiware Keystone API Create User

We are trying to create users in Fiware IDM using Keystone Identity API.
We are sending the following curl command
curl -s \
-H "X-Auth-Token: e746971040657101bb1e" \
-H "Content-Type: application/json" \
-d '{"user": {"name": "newuser", "password": "changeme"}}' \
http://localhost:35357/v3/users | python -mjson.tool
The token we have used is the one configured in keystone.conf
admin_token=e746971040657101bb1e
But the result we are getting is the following
{
"error": {
"code": 401,
"message": "The request you have made requires authentication.",
"title": "Unauthorized"
}
}
Does anyone have an idea about what can happen?
A couple of ideas for you.
One is that the port value 35357 is not for the admin API calls, it's intended for user calls.
Also since you are using the v3 API I believe that the token can't be used when creating a user unless you are indicating a domain.
However I can't tell from your curl command what action you are trying to do.

Resources