Coder Social home page Coder Social logo

Comments (5)

sirosen avatar sirosen commented on June 5, 2024 1

I've retitled this to be an "action item" which we can do and close. Just so that we have a clearer idea of what it means to close this.

I think the appropriate fix is for the tutorial doc to explicitly call out the requested_scopes parameter. An example flow specifically for Groups would probably be a good choice, as I expect it will be a common case.

We've had some improvements to the tutorial in the backlog for ages. Maybe it's finally time that we get to some of them...

from globus-sdk-python.

sirosen avatar sirosen commented on June 5, 2024

I gave my app the scope urn:globus:auth:scope:groups.api.globus.org:all

Do you mean that you passed this scope string for requested_scopes when starting the oauth flow, or that you set it in the web interface when creating your client?
As far as I know, the setting in the web UI is a legacy feature and doesn't do anything in the normal case. (We should remove it from the SDK tutorial.)

You should be able to pass that scope in when starting the flow. See docs on oauth2_start_flow parameters.

Also, as of SDK v3.0 you shouldn't need to hardcode the scope string. You can get it from globus_sdk.scopes under the name GroupsScopes or as GroupsClient.scopes (see doc on the scopes and scope builders). e.g.

from globus_sdk import GroupsClient

auth_client = ... # create an auth client for your app, varies by app type

auth_client.oauth2_start_flow(requested_scopes=[GroupsClient.scopes.all])

# follow the flow and get a token response, again this varies a little by app type
...
token_response = ...

# either using the scope
tokens = token_response.by_scopes[GroupsClient.scopes.all]
# or using the resource server
tokens = token_response.by_resource_server[GroupsClient.scopes.resource_server]

I generally would prefer the by_resource_server usage because that attribute is just a dictionary and you can easily inspect it. by_scopes is a fancy getter which crawls that same dictionary.

from globus-sdk-python.

zonca avatar zonca commented on June 5, 2024

thanks @sirosen
it works great now, please add this to the docs!

from globus-sdk-python.

zonca avatar zonca commented on June 5, 2024

@sirosen I wrote a small tutorial and shared my scripts in case it comes useful for your docs: https://zonca.dev/2021/09/globus-groups-python-sdk.html

from globus-sdk-python.

sirosen avatar sirosen commented on June 5, 2024

I just noticed that this was still open. It should have been closed back in #511, when I did a pass over the tutorial to do some updates.

from globus-sdk-python.

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.