1
votes

How to differantiate Youtube-Google linked account from unlinked with Youtube API. After successfuly retrieving information about currently logged user by sending this request:

https://gdata.youtube.com/feeds/api/users/default?v=2?access_token=YSECURITY_TOKEN&alt=json

I get JSON structure that contains user information. But there is no property that says wheather this user has linked or unlinked google account. By searching through Youtube API documentation and googling I could not find straight answer, only how to go on this page where you can check if your account is linked:

http://support.google.com/youtube/bin/answer.py?hl=en&answer=69964

I am using javascript and jQuery.

2

2 Answers

0
votes

Seems that I found it. Youtube API part of documentation that describes differnces between API version 2.0 and 2.1 says:

In version 2.1, a YouTube user profile entry for a user with an unlinked Google Account will contain a <yt:incomplete> tag. This tag is useful if you prefer to modify your application so that it does not display unsupported features (or provides a different display for those features) to users with unlinked Google Accounts.

In addition, in version 2.1, a profile entry for a user with an unlinked Google Account only contains a few of the tags that can be included in a profile entry for a user with a YouTube account. The <entry> tag definition lists the tags that may appear within a profile entry for both YouTube accounts and unlinked Google Accounts.

So I can then search if incomplete tag is present.

0
votes

YouTube API v2 has been deprecated. YouTube API v3 provides this interface: https://www.googleapis.com/youtube/v3/channels?part=status,snippet&mine=true

The result looks like { "kind": "youtube#channelListResponse", "etag": "\"DsOZ7qVJA4mxdTxZeNzis6uE6ck/ZcfqyiqeHVjpZe2OzRYKDx0FikI\"", "pageInfo": { "totalResults": 1, "resultsPerPage": 1 }, "items": [ { "kind": "youtube#channel", "etag": "\"DsOZ7qVJA4mxdTxZeNzis6uE6ck/XMRC3bd-8_FpW1Mxf8T-cDbmbns\"", "id": "UCsscztqpacVMxemmxNkwVQg", "snippet": { "title": "", "description": "", "publishedAt": "2012-07-17T03:19:15.000Z", "thumbnails": { "default": { "url": "https://i.ytimg.com/i/sscztqpacVMxemmxNkwVQg/1.jpg" }, "medium": { "url": "https://i.ytimg.com/i/sscztqpacVMxemmxNkwVQg/mq1.jpg" }, "high": { "url": "https://i.ytimg.com/i/sscztqpacVMxemmxNkwVQg/hq1.jpg" } } }, "status": { "privacyStatus": "private", "isLinked": false, "longUploadsStatus": "eligible" } } ] }

Notice the "isLinked" value in the status.