Skip to content

Instantly share code, notes, and snippets.

@chebyte
Created November 27, 2010 00:18
Show Gist options
  • Save chebyte/717387 to your computer and use it in GitHub Desktop.
Save chebyte/717387 to your computer and use it in GitHub Desktop.
support for authsub on youtube_it gem
require 'rubygems'
require 'youtube_it'
#first get the token user in this link
https://www.google.com/accounts/AuthSubRequest?
next=callback url
&scope=http%3A%2F%2Fgdata.youtube.com
&session=1
&secure=0
#with authsub
#this create a single-use token
client = YouTubeIt::AuthSubClient.new(:token => "token", :dev_key => "dev-key")
#to exchange a single-use token for a long-lived session token
puts token = client.create_session_token
#for create long token session (first you need create a single-use token then convert to session token)
client = YouTubeIt::AuthSubClient.new(:token => token, :dev_key => "dev-key")
#for revoke a session token
puts client.revoke_session_token
#for get info of session token, allow us see if the session is valid or no
puts client.session_token_info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment