Skip to content

Instantly share code, notes, and snippets.

@penso
Created September 15, 2011 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save penso/1219088 to your computer and use it in GitHub Desktop.
Save penso/1219088 to your computer and use it in GitHub Desktop.
Delivering Push Notifications with OAuth
# Read http://developer.4push.com/
require 'rubygems'
require 'oauth'
# Change those
consumer_key = "wJlvuDeAVCIO8Bb8ABRN"
consumer_secret = "fwVw4n1jdG4Rox25QPC3BXmYlABrO7brOsDpzgBe"
###
site = "http://www.appnotifications.com"
@consumer=OAuth::Consumer.new consumer_key, consumer_secret, {:site=>site}
@request_token=@consumer.get_request_token(:oauth_callback => "http://localhost/")
# Visit this and approve
@request_token.authorize_url
# Use the oauth_verifier you got from the authorize_url once approved
@access_token = @request_token.get_access_token(:oauth_verifier => "tjyhCPEXOCAORlDiocVk")
@access_token.get "/account/notifications.json"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment