Index: youtube_api.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/youtube_api/youtube_api.module,v retrieving revision 1.13 diff -u -r1.13 youtube_api.module --- youtube_api.module 23 Jul 2008 05:04:01 -0000 1.13 +++ youtube_api.module 25 Feb 2009 12:04:13 -0000 @@ -56,6 +56,13 @@ '#collapsed' => TRUE, ); + $form['advanced']['youtube_api_authsub_location'] = array( + '#type' => 'textfield', + '#title' => t('Location for API AuthSub Calls'), + '#default_value' => variable_get('youtube_api_authsub_location', 'https://www.google.com/accounts/AuthSubRequest'), + '#description' => t('This should only be changed if the YouTube API specifications change.'), + ); + $form['advanced']['youtube_api_login_location'] = array( '#type' => 'textfield', '#title' => t('Location for API Login Calls'), @@ -110,6 +117,21 @@ } /** + * Logs a user into the YouTube API via AuthSub + * + * @param $redirection url to redirect too after authentication at youtube.com + * @return FALSE on failure + */ +function youtube_api_login_authsub($next, $secure = false, $session = true) { + $scope = 'http://gdata.youtube.com'; + $response = drupal_http_request(variable_get('youtube_api_authsub_location', 'https://www.google.com/accounts/AuthSubRequest') .'?next='. urlencode($next) .'&session='. $session .'&secure='. $secure .'&scope='. urlencode($scope), array('Content-Type' => 'application/x-www-form-urlencoded'), 'POST'); + if ($response->code == 200) { + return TRUE; + } + return FALSE; +} + +/** * Logs a user into the YouTube API. Returns FALSE on failure. * * @param $login