Created
October 20, 2011 01:25
-
-
Save amitsaxena/1300167 to your computer and use it in GitHub Desktop.
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
def url_for_oauth_code(options = {}) | |
# for permissions, see http://developers.facebook.com/docs/authentication/permissions | |
permissions = options[:permissions] | |
scope = permissions ? "&scope=#{permissions.is_a?(Array) ? permissions.join(",") : permissions}" : "" | |
display = options.has_key?(:display) ? "&display=#{options[:display]}" : "" | |
callback = options[:callback] || @oauth_callback_url | |
raise ArgumentError, "url_for_oauth_code must get a callback either from the OAuth object or in the options!" unless callback | |
# Creates the URL for oauth authorization for a given callback and optional set of permissions | |
"https://#{GRAPH_SERVER}/oauth/authorize?client_id=#{@app_id}&redirect_uri=#{callback}#{scope}#{display}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment