YouTube APIs - Access mutiple youtube channels (Brand Accounts) using Google Admin account

后端 未结 3 901
时光取名叫无心
时光取名叫无心 2020-11-30 06:04

I need to extract information from videos using YouTube Analytics and Reporting Api.

I have access to multiple YouTube Brand Accounts, when I log into YouTube with

3条回答
  •  青春惊慌失措
    2020-11-30 07:02

    If you follow the solution for getting a permanent refresh token and use Java, this works for me

    GoogleCredential credential = new GoogleCredential.Builder().setTransport(httpTransport)
                        .setJsonFactory(JSON_FACTORY)
                        .setClientSecrets(oauth2ClientId, oauth2ClientSecret)
                        .build()
                        .setRefreshToken(oauth2RefreshToken);
    
    
     this.youTubeClient = new YouTube.Builder(httpTransport, JSON_FACTORY, credential)
                        .setApplicationName(APPLICATION_NAME)
                        .build();
    

    Required dependencies

    
        com.google.apis
        google-api-services-youtube
        v3-rev212-1.25.0
        
    
        com.google.auth
        google-auth-library-oauth2-http
        0.18.0
    
    

    These resources might also help once you have the refresh token:

    • Authenticate programmatically to Google with OAuth2
    • https://blog.timekit.io/google-oauth-invalid-grant-nightmare-and-how-to-fix-it-9f4efaf1da35

提交回复
热议问题