summaryrefslogtreecommitdiff
path: root/gettoken.rb
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@omgwallhack.org>2015-10-21 16:47:05 -0700
committerJoe Rayhawk <jrayhawk@omgwallhack.org>2015-10-21 16:47:05 -0700
commitd7eef063a7d993dcd91a701f151597a678b09190 (patch)
tree22968b9e611614266bae49d451ad1ff6aea3038e /gettoken.rb
downloadtwitchtools-d7eef063a7d993dcd91a701f151597a678b09190.tar.gz
twitchtools-d7eef063a7d993dcd91a701f151597a678b09190.zip
twitchtools: initial commit
Diffstat (limited to 'gettoken.rb')
-rwxr-xr-xgettoken.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/gettoken.rb b/gettoken.rb
new file mode 100755
index 0000000..7896e5a
--- /dev/null
+++ b/gettoken.rb
@@ -0,0 +1,45 @@
+#!/usr/bin/ruby
+
+require 'twitch'
+require 'pp'
+
+confdir = Dir.home + '/.config/twitch/'
+ENV['APPDATA'] && confdir = ENV['APPDATA'] + "\\twitch\\"
+ENV['XDG_CONFIG_HOME'] && confdir = ENV['XDG_CONFIG_HOME'] + '/twitch/'
+
+client_id = IO.read( confdir+'client_id' ).chomp
+secret_key = IO.read( confdir+'secret_key' ).chomp
+redirect_uri = IO.read( confdir+'redirect_uri' ).chomp
+
+# Feel free to use https://www.omgwallhack.org/toys/env.cgi as a redirect URI; I am probably too lazy to steal your oauth token.
+
+scope = '
+user_read
+user_blocks_edit
+user_blocks_read
+user_follows_edit
+channel_read
+channel_editor
+channel_commercial
+channel_stream
+channel_subscriptions
+channel_check_subscription
+chat_login
+'.split.sort.uniq
+
+twitch = Twitch.new({
+ :client_id => client_id,
+ :secret_key => secret_key,
+ :redirect_uri => redirect_uri,
+ :scope => scope,
+})
+
+print( twitch.getLink + "\n" )
+
+#access_token = twitch.auth(code)[:body]["access_token"]
+#
+#twitch=Twitch.new({
+# :access_token => access_token
+#})
+#
+#channel = twitch.getYourChannel