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

specifying the https://www.googleapis.com/auth/youtubepartner-channel-audit scope is not working #6

Open
Revnoplex opened this issue Nov 8, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Revnoplex
Copy link
Owner

Revnoplex commented Nov 8, 2024

Specifying the youtubepartner-channel-audit scope is not working correctly.
When authorising via

ayt_api.AsyncYoutubeAPI.generate_url_and_socket(
    "CLIENT_ID",
    OAuth2Scope.youtube_partner_channel_audit
)

The scope appears on the consent screen fine, and everything else works ok up until

await api.fetch_channel_from_handle("CHANNEL_HANDLE", True)

which raises

Traceback (most recent call last):
  File "/path/to/test/file.py", line 561, in <module>
    asyncio.run(test_function())
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/.local/lib/python3.13/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ~~~~~~~~~~^^^^^^
  File "/home/username/.local/lib/python3.13/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/username/.local/lib/python3.13/asyncio/base_events.py", line 721, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/path/to/test/file.py", line 554, in test_function
    data = await auth_api.fetch_channel_from_handle("Revnoplex", True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/username/Documents/GitHub/ayt-api/ayt_api/api.py", line 1090, in fetch_channel_from_handle
    return await self._call_api(
           ^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )
    ^
  File "/home/username/Documents/GitHub/ayt-api/ayt_api/api.py", line 510, in _call_api
    raise HTTPException(yt_api_response, message, error_data)
ayt_api.exceptions.HTTPException: 403 Forbidden: The caller does not have permission

Due to the API returning a 403 status code with the following data:

{
    "code": 403, 
    "message": "The caller does not have permission", 
    "errors": [{
        "domain": "youtube.api.CommonRequestError", 
        "reason": "ERROR_MISSING_SCOPE"
    }], 
    "status": "PERMISSION_DENIED"
}

Even though the scope seems to be specified. I am able to not reproduce this using Google's OAuth2 playground so its a problem on the library's side.
The error could possibly be narrowed down to one of the following:

  • The scope url is spelt incorrectly
  • The scope is not being used in the correct way (most likely but harder to fix as I would have to figure out what I'm doing wrong and how to implement it correctly so I hope this isn't the case and its something much simpler)
@Revnoplex Revnoplex added bug Something isn't working 0.4.0 todo list Todo lists for 0.4.0 release labels Nov 8, 2024
@Revnoplex Revnoplex added this to the v0.4.0 milestone Nov 8, 2024
@Revnoplex Revnoplex mentioned this issue Nov 8, 2024
17 tasks
@Revnoplex Revnoplex removed the 0.4.0 todo list Todo lists for 0.4.0 release label Nov 9, 2024
@Revnoplex Revnoplex removed this from the v0.4.0 milestone Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant