-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Common approach for .netrc authentication? #60
Comments
This is work in progress but for the next release we could use from earthdata import Auth
auth = Auth().login(strategy="netrc")
# are we authenticated?
if not auth.authenticated:
# ask for credentials and persist them in a .netrc file
auth.login(strategy="interactive", persist=True) I'm thinking about writing some tests for password with special characters or currently malformed |
Not sure if it would be helpful but pytool's create_netrc will either create the netrc with the username and password or add it to an existing netrc with the earth data login. It is adapted from the NASA git authentication script. from uavsar_pytools.uavsar_tools import create_netrc
create_netrc() #will password safe prompt for username and password |
scratch that I see that the earth data setup looks better. |
I've noticed lots of tutorials each starting with a slightly different piece of code to check if there is a a valid .netrc, and if not, create one. This has led to errors in past hackweeks, where for example special characters aren't recognised, untested code creates (or overwrites) malformed ~/.netrcs, etc.
@egreckase (+ @betolink) would you recommend sticking with the earthdata library across tutorials for this critical step? Or adding a script that everyone can run on the jupyterhub (https://nasa-openscapes.github.io/2021-Cloud-Hackathon/tutorials/04_NASA_Earthdata_Authentication.html)?
Our current recommendation is here and could be revised https://snowex.hackweek.io/preliminary/earthdata.html#configure-programmatic-access-to-nasa-servers
The text was updated successfully, but these errors were encountered: