Skip to content
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

Can't change the scope for oauth2 authentication #11

Open
dkbarn opened this issue Oct 12, 2020 · 3 comments
Open

Can't change the scope for oauth2 authentication #11

dkbarn opened this issue Oct 12, 2020 · 3 comments

Comments

@dkbarn
Copy link

dkbarn commented Oct 12, 2020

When using stravaio_oauth2 to authenticate an application, there is no way to change the access scope to allow for write access to anything. The scope has been hardcoded to read access only: https://github.com/sladkovm/stravaio/blob/master/stravaio.py#L366

The scope should be exposed as an argument to the public strava_oauth2 function.

@dkbarn
Copy link
Author

dkbarn commented Oct 12, 2020

Ok I think I misunderstood what this library was. I thought it was a Python wrapper around the complete Strava REST API, but apparently it is limited to only reading information from Strava and cannot do any writing/uploading to Strava.

The name StravaIO is misleading, maybe it should be renamed to StravaO.

@Tim-Haarman
Copy link

I have the same problem, the lib seems great but I can't use it for my own data because I have all my activities set on private and can't change the hardcoded scope which only allows for retrieving public activities. It sadly seems like this project isn't maintained anymore, but if it gets picked up again it would be nice to have the scope as a parameter.

@nickswalker
Copy link

nickswalker commented Dec 28, 2022

If you just need read access to private activities, you can monkey patch in the read_all scope:

import stravaio
# Before you do anything with stravaio
def _request_strava_authorize(client_id, port):
    import webbrowser
    import urllib
    params_oauth = {
        "client_id": client_id,
        "response_type": "code",
        "redirect_uri": f"http://localhost:{port}/authorization_successful",
        "scope": "read,profile:read_all,activity:read_all",
        "state": 'https://github.com/sladkovm/strava-http',
        "approval_prompt": "force"
    }
    values_url = urllib.parse.urlencode(params_oauth)
    base_url = 'https://www.strava.com/oauth/authorize'
    rv = base_url + '?' + values_url
    webbrowser.get().open(rv)
    return None

stravaio._request_strava_authorize = _request_strava_authorize

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants