Noam Maoz
Noam Maoz

Reputation: 269

YouTube Data API - Get Channel ID from Email

I'm trying to retrieve Youtube channel ID and name using Youtube data API but I'm getting empty item. I have only the Youtube user email account. Is there away to get the channel details from the email only?

https://www.googleapis.com/youtube/v3/channels?part=snippet&key={YOUR_API_KEY}

Upvotes: 1

Views: 2943

Answers (2)

Noam Maoz
Noam Maoz

Reputation: 269

There is no way to get the user channel ID from user email. I have tried to use forUsername parameter but this works only for some users (legacy issue). The only I have found is to use Google Signin for iOS implementation which allow you yo signin with your google account. In order to have that ability to get YouTube data it require additional scope configuration as follows:

let scope: NSString = "https://www.googleapis.com/auth/youtube.readonly"
let currentScopes: NSArray = GIDSignIn.sharedInstance().scopes
GIDSignIn.sharedInstance().scopes = currentScopes.arrayByAddingObject(scope)

Now, you can run the following YouTube data API with Access Token:

https://www.googleapis.com/youtube/v3/channels?part=id&mine=true&access_token={oauth_token}

The access token, you will get from user.authentication.accessToken

Upvotes: 3

Janyk
Janyk

Reputation: 571

There is no way of retrieving YouTube channels via their associated e-mailaddress at this moment.

Upvotes: 0

Related Questions