Skip to content

Authenticate with Earthdata Login using environment variables

Important

You will need a NASA Earthdata Login account to download or stream NASA Earthdata. To obtain a NASA Earthdata Login account , please follow the instructions at NASA EDL

You will need to create two environment variables: EARTHDATA_USERNAME and EARTHDATA_PASSWORD. Instructions for creating these environment variables can be found here.

Once you have created your environment variables you can use earthaccess.login to authenticate.

import earthaccess

auth = earthaccess.login()

You can also set your login strategy explicitly by setting strategy="environment".

auth = earthaccess.login(strategy="environment")

Instead of using EARTHDATA_USERNAME and EARTHDATA_PASSWORD, you can set the environment variable EARTHDATA_TOKEN to an existing Earthdata Login token and use the same "environment" strategy as above.

See the Authentication explanation page for more details.