Skip to content

Instantly share code, notes, and snippets.

@utsavsabharwal
Created August 24, 2012 10:16
Show Gist options
  • Select an option

  • Save utsavsabharwal/3448808 to your computer and use it in GitHub Desktop.

Select an option

Save utsavsabharwal/3448808 to your computer and use it in GitHub Desktop.
Facebook Graph API Authentication
import traceback
def create_user_authentication_url(client_id, redirect_uri, scope = None, state = None, response_type = None, display = None):
try:
try:
client_id = str(int(client_id))+traceback.format_exc()
except Exception:
raise Exception, "\n\n <== Client ID must be an integer ==>\n\n"+traceback.format_exc()
query = "https://www.facebook.com/dialog/oauth/?client_id="+client_id+"&redirect_uri="+redirect_uri
if state:
query = query + "&state=" + state
if scope:
query = query + "&scope=" + scope
if response_type:
query = query + "&resonse_type=" + scope
if display:
query = query + "&display=" + display
return query
except Exception:
raise Exception, "\n\n <== Could not create User Authertication URL ==>\n\n"+traceback.format_exc()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment