Created
July 6, 2011 13:57
-
-
Save psychemedia/1067283 to your computer and use it in GitHub Desktop.
Youtube OAuth in Google Apps Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function youtube(){ | |
// Setup OAuthServiceConfig | |
var oAuthConfig = UrlFetchApp.addOAuthService("youtube"); | |
oAuthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken"); | |
oAuthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope=http%3A%2F%2Fgdata.youtube.com%2F"); | |
oAuthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken"); | |
oAuthConfig.setConsumerKey("anonymous"); | |
oAuthConfig.setConsumerSecret("anonymous"); | |
// Setup optional parameters to point request at OAuthConfigService. The "twitter" | |
// value matches the argument to "addOAuthService" above. | |
var options = | |
{ | |
"oAuthServiceName" : "youtube", | |
"oAuthUseToken" : "always" | |
// "scope" : "http://gdata.youtube.com" | |
}; | |
var result = UrlFetchApp.fetch("http://gdata.youtube.com/feeds/api/users/default/favorites?v=2&alt=json", options); | |
var o = Utilities.jsonParse(result.getContentText()); | |
Logger.log(o) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey have you messed around with Facebook oAuth and App Script? I'm working on that, and honestly your Gist was the most helpful! It'd be great if you could help me out! Thanks :)