token = oauth_server.fetch_request_token(oauth_request) except OAuthError, e: return oauth_error_response(e) if OAuthMap.get_from_request_token(token.key_): logging.error("OAuth key %s already used" % token.key_) params = dict([(key, request.get(key)) for key in request.arguments()]) logging.info("params: %r" % params) logging.info("Authorization: %s", request.headers.get('Authorization')) return oauth_error_response(OAuthError("OAuth parameters already " "used.")) # Start a new OAuth mapping oauth_map = OAuthMap() oauth_map.request_token_secret = token.secret oauth_map.request_token = token.key_ oauth_map.callback_url = requested_oauth_callback() if request.values.get("view") == "mobile": oauth_map.view = "mobile" oauth_map.put() chooser_url = ("/login/mobileoauth?oauth_map_id=%s&view=%s" % (oauth_map.key().id(), oauth_map.view)) oauth_consumer = oauth_server._get_consumer(oauth_request) if oauth_consumer and oauth_consumer.anointed: chooser_url += "&an=1" return redirect(chooser_url)
except OAuthError, e: return oauth_error_response(e) if OAuthMap.get_from_request_token(token.key_): logging.error("OAuth key %s already used" % token.key_) params = dict([(key, request.get(key)) for key in request.arguments()]) logging.info("params: %r" % params) logging.info("Authorization: %s", request.headers.get('Authorization')) return oauth_error_response( OAuthError("OAuth parameters already " "used.")) # Start a new OAuth mapping oauth_map = OAuthMap() oauth_map.request_token_secret = token.secret oauth_map.request_token = token.key_ oauth_map.callback_url = requested_oauth_callback() if request.values.get("view") == "mobile": oauth_map.view = "mobile" oauth_map.put() chooser_url = ("/login/mobileoauth?oauth_map_id=%s&view=%s" % (oauth_map.key().id(), oauth_map.view)) oauth_consumer = oauth_server._get_consumer(oauth_request) if oauth_consumer and oauth_consumer.anointed: chooser_url += "&an=1" return redirect(chooser_url)