Skip to content

Instantly share code, notes, and snippets.

@jhjguxin
Created October 10, 2012 09:22
Show Gist options
  • Save jhjguxin/3864321 to your computer and use it in GitHub Desktop.
Save jhjguxin/3864321 to your computer and use it in GitHub Desktop.
sina authorize_url with with_offical_account params
Weibo2::Strategy::AuthCode.class_eval do
# place inside initializers
# The Authorization Code Strategy
# setting on yml
# with_offical_account: "1"
# @see http://tools.ietf.org/html/draft-ietf-oauth-v2-15#section-4.1
def authorize_url(params={})
params = {:redirect_uri => @client.redirect_uri}.merge(params)
params = params.merge({"with_offical_account" => with_offical_account}) if with_offical_account?
super params
end
private
def with_offical_account
Askjane::Config.sina[:with_offical_account] if Askjane::Config.sina[:with_offical_account].present?
end
def with_offical_account?
true if Askjane::Config.sina[:with_offical_account].eql? "1"
end
end
#client = Weibo2::Client.new
#client.auth_code.authorize_url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment