How to fetch youtube channel info using google login button
-
Hi,
first of all thanks for your awesome plugin. I am using “sign in with google” feature from this plugin. But I also need to fetch youtube channel info after login. I have whole code for getting youtube channel info, but in my code need to “access_token” or “refress_token”. But I don’t know how to get access_token form your plugin or add youtube scope. Please help me.
$url = 'https://www.googleapis.com/youtube/v3/channels?fields=items(id,snippet(title,description,customUrl,thumbnails(default)),statistics(viewCount,subscriberCount))&part=snippet%2Cstatistics&mine=true&access_token='.$access_token; $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); $channelOBJ = json_decode( curl_exec( $ch ) ); $channel_id = $channelOBJ->items[0]->id; $thumbnail_url = $channelOBJ->items[0]->snippet->thumbnails->default->url; $youtubetitle = $channelOBJ->items[0]->snippet->title; $description = $channelOBJ->items[0]->snippet->description; $total_subscriber = $channelOBJ->items[0]->statistics->subscriberCount;
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to fetch youtube channel info using google login button’ is closed to new replies.