Использование учетных данных Django Allauth вместо потока Google

Я пытаюсь запустить видеопоток на Youtube с помощью Django, но, похоже, мои учетные данные не работают должным образом.

Для создания потока я использую только resource__owner_secret в качестве учетной записи при запуске потока. Вот view.py

from django.shortcuts import render

#import google_auth_oauthlib.flow
import googleapiclient.discovery
import googleapiclient.errors

from allauth.socialaccount.models import SocialAccount, SocialApp

scopes = ["https://www.googleapis.com/auth/youtube.force-ssl"]

api_service_name = "youtube"
api_version = "v3"
#client_secrets_file = "app/client_secret.json"

def index(request):
    if request.method == 'PUT':
        google_app = SocialApp.objects.get(provider='google')
        user_account = SocialAccount.objects.get(user=request.user)
        client_key = google_app.client_id
        user_token = user_account.socialtoken_set.first()
        resource_owner_key = user_token.token
        resource_owner_secret = user_token.token_secret

        #flow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file(client_secrets_file, scopes)
        # credentials = flow.run_console()
        credentials = resource_owner_secret
        print(credentials)

        youtube = googleapiclient.discovery.build(
            api_service_name, api_version, credentials=credentials)
        
        request = youtube.liveStreams().insert(
            part="snippet,cdn,contentDetails,status",
            body={
                "cdn": {
                    "frameRate": "60fps",
                    "ingestionType": "rtmp",
                    "resolution": "1080p"
                },
                "contentDetails": {
                    "isReusable": True
                },
                "snippet": {
                    "title": "Your new video stream's name",
                    "description": "A description of your video stream. This field is optional."
                }
            },
            onBehalfOfContentOwnerChannel="<MY_CHANNEL_ID>"
        )
        request.execute()

    return render(request, 'index.html')

Есть идеи, почему запуск прямого эфира не работает?

Вернуться на верх