Created
October 10, 2012 09:22
-
-
Save jhjguxin/3864321 to your computer and use it in GitHub Desktop.
sina authorize_url with with_offical_account params
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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