Code Monkey home page Code Monkey logo

Comments (10)

rabernat avatar rabernat commented on June 11, 2024

Seems related: googleapis/google-auth-library-python#217

from gcsfs.

martindurant avatar martindurant commented on June 11, 2024

The "service" route does already have the scopes set ( https://github.com/dask/gcsfs/blob/master/gcsfs/core.py#L370 ), but - shooting in the dark here - I can add it also to the file-based auth. I wouldn't have thought that made a difference, but you could try git+https://github.com/martindurant/gcsfs@scoped. If not, it would be useful to know via pdb what fs.method ended up as.

from gcsfs.

rabernat avatar rabernat commented on June 11, 2024

Ok, I will try that branch later today or tomorrow.

Do you recommend a different method of authentication?

from gcsfs.

martindurant avatar martindurant commented on June 11, 2024

If you have a .json file, you can always pass that directly to the constructor GCSFileSystem(token='/path/to/file.json', project='my-project'), and should also explicitly give the appropriate project=.

In the past, google-default and cloud auth mechanisms have worked without problem. If you give no indication to GCSFileSystem at all, it will try the various methods in turn, and it seems that something apparently gave no error (some auth was found), but the auth was actually incomplete. Or something. I would expect token='cloud' to be the smoothest method on GCE.

from gcsfs.

rabernat avatar rabernat commented on June 11, 2024

I am not on GCE. I am on pleiades.

I will try passing the token explicity.

from gcsfs.

rabernat avatar rabernat commented on June 11, 2024

It looks like specifying the token='/path/to/file.json' works. Sorry for the clutter.

However, it would be great if gcsfs would read the GOOGLE_APPLICATION_CREDENTIALS environment variable and use this to fill in token. I could try to put together a PR for this if you wish.

from gcsfs.

martindurant avatar martindurant commented on June 11, 2024

That's an impressive cluster!

I agree that GOOGLE_APPLICATION_CREDENTIALS should be respected, but I am surprised that gauth.default() doesn't pick this up already. Your original point about providing a more sensible error message, preferably when connecting as opposed to the first usage, still stands - but I am not sure how to achieve this.

from gcsfs.

martindurant avatar martindurant commented on June 11, 2024

OK, so what I understand is that google.auth.default() is supposed to respect GOOGLE_APPLICATION_CREDENTIALS, but "old" credentials can be missing scopes and/or project identifiers. Perhaps google.cloud.storage.Client knows how to deal with that. I can add the scopes to the default credentials, which apparently will use them "if necessary" - doesn't actually seem to make any difference to me.

from gcsfs.

rabernat avatar rabernat commented on June 11, 2024

I just created / downloaded the credentials yesterday. How can they be "old" already?

from gcsfs.

martindurant avatar martindurant commented on June 11, 2024

I just created / downloaded the credentials yesterday. How can they be "old" already?

I don't know :( It's hard to try to say what the google auth library actually did for your case.

from gcsfs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.