youtube api& amp;的问题google people api&品牌帐户

时间:2017-01-13 12:15:51

标签: google-api youtube-api

我创建了一个使用Google People API服务的Google登录应用。但是我还需要访问用户youtube频道。

这可以为登录用户提供选择他们想要登录的频道的选项。如果他们使用他们的主帐户登录,则没有问题。

然而,它很可能拥有多个频道(现在称为品牌账户)。这里的问题是,我会获得正确的YouTube频道ID,但用户详细信息将用于品牌帐户,电子邮件是硬编码的电子邮件,例如:testing-1234@pages.plusgoogle.com

查看品牌帐户管理页面,它表示发送到该电子邮件应该发送给主帐户持有者。然而,最明确的是没有发生这种情况。

我还尝试了一种自动增量方法来请求权限,但这并不起作用,因为每个用户帐户都直接链接到YouTube频道,登录后只返回该(品牌)帐户的默认帐户。

我只是不确定我的意思是如何可靠地获取他们想要与我们的系统一起使用的人(有效)电子邮件地址和youtube频道。

任何指针都非常赞赏

1 个答案:

答案 0 :(得分:2)

I know that you can use google sign in to authenticate a login to a youtube channel. That sign in asks for the email account that is associated with the channel. I believe (in the android code I work on at least) I can get to a channels list from there. But a user could pick any email address from the initial login to get to the youtube account associated with that email address if they have the credentials.

this has a way to execute requests on the api and an update function too.

Branding channels

This is a sample that gets a channel list and then uses index 0 for the channelId:

 YouTube youtube = new YouTube.Builder(transport, jsonFactory,
                    credential).setApplicationName(getString(R.string.app_name))
                    .build();


            YouTube.Playlists.List playLists;
            PlaylistListResponse playlistListResponse = null;
            List<PlaylistData> PlaylistData = new ArrayList<PlaylistData>();


            try {

                ChannelListResponse clr = youtube.channels().list("contentDetails")
                        .setMine(true).execute();

                playLists = youtube.playlists().list("id,status,snippet");
                playLists.setChannelId(clr.getItems().get(0).getId());