Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Earthdata Login has recently added functionality so that users can generate  User tokens for themselves via the EDL GUI or the API.  User tokens are valid for a duration of 90 days.  Users can generate these tokens and use them with compatible applications during the application authorization process.  A user is allowed a maximum of two valid user tokens at any given time.  If you already have two valid user tokens, and wish to generate a new token  please delete  and existing token and generate a new one.  


Generating a User token from EDL GUI

Visit Earthdata Login (https://urs.earthdata.nasa.gov if you are looking for Production environment) and Login with your credentials


Image Added


On successful login you are redirected to your profile page.  Locate "Generate Token" link in the sub navigation as indicated in the image below.


Image Added


On clicking the 'Generate Token' link in the above image, you will be redirected to the User token generation page.   You should see 'Generate Token' button at the bottom as shown in the picture below.  


Image Added


Click on the "Generate Token" button in the above page.  You will be redirected to the page as shown in the picture below.  A user token is generated for you but it is hidden for security purposes..


Image Added


Click on the 'Show Token' button to view the generated user token.  You can toggle between show and hide token by clicking on the button, as shown in the button below.


Image Added


You can delete an existing token by clicking on the. 'X' button as indicated in the image below.



Image Added



Generating EDL User Token via the API.

Anchor
createtokenApi
createtokenApi

/api/users/token

Allowed Methods

POST


Description

Creates a new user token.  `Authorization: Basic` header  with Base64 encoded user credentials is required for creating a new user token.

Authorization: Basic (user-username:user-password Base64-encoded)


Examples

Notes

Request

Response

Status Code 200 with user credentials in the header

curl --request POST \
--url 'https://urs.earthdata.nasa.gov/api/users/token' -H "Authorization: Basic Base64encodedcredentials"

Status Code: 200


{

"access_token":"EDL-Ued17ddb5f6a6afdceba7560d2b058777adfd2fd4b730c90ec46ad3a9602",

"token_type":"Bearer",

"expiration_date":"07/14/2021"

}

If the user already has maximum allowed(2) user tokens

curl --request POST \
  --url 'https://urs.earthdata.nasa.gov/api/users/token -H 'Authorization: Basic Base64encodedcredentials"


Status Code: 403


{
  "error":"max_token_limit","error_description":"User already has maximum number of tokens."
}

Invalid credentials or Missing header with credentials

curl --request POST \
  --url 'https://urs.earthdata.nasa.gov/api/users/token -H 'Authorization: Basic Base64encodedcredentials"

Status Code: 401

{
  "error":"invalid_credentials",

"error_description":"Invalid user credentials"
}