Wednesday, September 29, 2010

CodeIgniter, OAuth, Youtube, and Me

The site I am currently working on GamerGameOn requires authentication with youtube to pull videos to show. Needless to say this has been quite a task. OAuth documentation while good tends to be quite technical, and in some cases, out of date but getting it to work isn't impossible and most of the issues I have encountered have ended up being my own fault. Here is my youtube library. I wrote this instead of using the Zend GData implementation because I didn't want to include a number of other libraries and files that I wouldn't be using. The link to the article is here:  This is just the OAuth request and access library the actual youtube library needs some cleaning up but it all works pretty well. Read the doc in there for a very detailed look at OAuth for google and CodeIgniter.

As I say in the wiki post this is supposedly a general Google OAuth library according to docs all you need to do is change the scope constant to have it work with another google service. I never tested this so I don't know if it's true but in theory it should work.

Here are dropbox links to the files if you would rather download them.

1 comment:

  1. I got HMAC-SHA1 working for youtube by urlencoding both the secret and the oauth_secret_token parameter:

    $secret = urlencode($secret);
    $secret .= '&'.urlencode($parameters['oauth_token_secret']);