Permalink
Browse files

added authentication option to oauth

  • Loading branch information...
1 parent 51a27e7 commit aa8c55771e04ef8eae428637cc240938b39d3d5e Michael Shapiro committed Aug 3, 2010
Showing with 13 additions and 1 deletion.
  1. +6 −1 app.py
  2. +7 −0 meetup_api_client.py
View
7 app.py
@@ -54,6 +54,8 @@ def set_token(config, name, key, secret):
help='oauth_callback for request-token request, defaults to oob')
option.add_option('--callback', dest='callback', default='oob',
help='oauth_verifier, required to gain access token')
+ option.add_option('--authenticate', dest='authenticate', action='store_true',
+ help='pass in to use authentication end point')
(options, args) = option.parse_args()
config_name, config = get_config(options.config)
@@ -91,7 +93,10 @@ def access_granted():
set_token(config, 'request', oauth_session.request_token.key, oauth_session.request_token.secret)
- url = oauth_session.get_authorize_url()
+ if (options.authenticate):
+ url = oauth_session.get_authenticate_url()
+ else:
+ url = oauth_session.get_authorize_url()
print "Opening a browser on the authorization page: %s" % url
webbrowser.open(url)
View
@@ -147,6 +147,13 @@ def get_authorize_url(self, oauth_callback=None):
callbackUrl = ""
return OAUTH_BASE_URL + "authorize/?oauth_token=%s%s" % (self.request_token.key, callbackUrl)
+ def get_authenticate_url(self, oauth_callback=None):
+ if oauth_callback:
+ callbackUrl = "&" + urlencode({"oauth_callback":oauth_callback})
+ else:
+ callbackUrl = ""
+ return OAUTH_BASE_URL + "authenticate/?oauth_token=%s%s" % (self.request_token.key, callbackUrl)
+
def fetch_access_token(self, oauth_verifier, signature_method=signature_method_hmac, request_token=None):
temp_request_token = request_token or self.request_token
if not temp_request_token:

0 comments on commit aa8c557

Please sign in to comment.