See below for an example to get Launchpad token from the Token Service. These steps will walk you through how to get the token you need to ingest in the CMR UAT and Prod environments.
To get a Launchpad token, you need to create a curl command that will send the information for your PKI certificate to the Launchpad token service. In this curl command, you'll need to include the local path to where you saved your PKI certificate to your machine. You'll also need to include the password for your PKI certificate, which can be set up as an environment variable $pcode so it's not displayed when you enter your curl command. Finally, you need to specify the URL of the Launchpad token service. An example curl command will look like this:
curl -i --cert /Users/yliu10/Downloads/Modify-002888773.pfx:$pcode --cert-type P12 https://api.launchpad.nasa.gov/icam/api/sm/v1/gettoken
(Note: if you are trying to use SIT the url is to the sandbox: https://api.launchpad-sbx.nasa.gov)
The gettoken request would return something like the following:
The sm_token is the Launchpad token. You'll want to create a file on your local machine to store your token information for ease of use. To ensure your token works correctly, you can validated it against the Launchpad token service. To do so, you'll create a curl command that includes the path to your PKI certificate, the Launchpad token service URL, and the local path to the file where your token information is stored.
curl -XPOST -v --cert-type P12 --cert /Users/yliu10/Downloads/Modify-002888773.pfx:$pcode -H "Content-Type: application/json" https://api.launchpad.nasa.gov/icam/api/sm/v1/validate -d @/Users/yliu10/Downloads/token
In this example, /Users/yliu10/Downloads/token is our file holding the Launchpad token to be validated in JSON.
The validation request would return something like the following: