vimeo / vimeo.py

Official Python library for the Vimeo API.
https://developer.vimeo.com
Apache License 2.0
209 stars 84 forks source link

"You have been banned" error when trying to post comment with token of another user. #181

Closed Quohen-Leth closed 2 years ago

Quohen-Leth commented 2 years ago

Hi! I'm trying to give users possibility to post a comments on Vimeo video using OAuth. Here is my code:

# Initializing client.
client = vimeo.VimeoClient(
    token=config["access_token"],
    key=config["client_id"],
    secret=config["client_secret"]
)
# Making URI to get auth code.
scope_list = ["public", "private", "interact"]
auth_url = client.auth_url(scope_list, REDIRECT_URI, STATE)
# Getting code from REDIRECT_URI params.
code = request.GET.get("code", None)
state = request.GET.get("state", None)
# Getting access token.
access_token, _user, _scope = client.exchange_code(code, REDIRECT_URI)
# Using this token to post a comment
comment = {"text": "Some comment"}
video_url = f"https://api.vimeo.com/videos/{video_id}/comments/"
response = client.post(
    video_url, headers={"Authorization": f"bearer {access_token}"}, data=comment}
)

Everithing goes well, except the last step. When client with its config["access_token"], registered previously for "my app", tries to post a comment with token of another user access_token it got "You have been banned" error.

How to use token of end user correctly?

aaronm67 commented 2 years ago

The "You have been banned" message is incorrect here, thank you for letting us know.

The issue you're receiving is the token must have the "interact" scope to post comments.

Quohen-Leth commented 2 years ago

The "You have been banned" message is incorrect here, thank you for letting us know.

The issue you're receiving is the token must have the "interact" scope to post comments.

Thank You. I didn't set scopes correctly.