2

I'm trying to authenticate a python command line script agains my app engine application using oauth.

I'm following these instructions but I still don't get the "big picture" of how it works.

Is this api "ready to use"? or should I implement the request handlers for the oauth process?.

So far, I have my app deployed and I'm using this oauth library, I'm trying this example with the following values:

SERVER = 'myapp.appspot.com'
PORT = 443 # Also tried 80

REQUEST_TOKEN_URL = '/_ah/OAuthGetRequestToken'
ACCESS_TOKEN_URL = '/_ah/OAuthGetAccessToken'
AUTHORIZATION_URL = '/_ah/OAuthAuthorizeToken'
CALLBACK_URL = 'oob'
RESOURCE_URL = 'http://myapp.appspot.com/'

CONSUMER_KEY = 'myapp.appspot.com'
CONSUMER_SECRET = 'AaB8BtzxM7Dr7wz9Dxc5y6gG'

Do I have to implement any request handler on the server side? Do I have to enable this api somewhere?

Thanks for any clarification.

EDIT: Here is the output of the client script running:

$ python test.py ** OAuth Python Library Example **

* Obtain a request token ...

REQUEST (via headers)
parameters: {'oauth_nonce': '64747931', 'oauth_timestamp': 1325595310, 'oauth_consumer_key': 'myapp.appspot.com', 'oauth_signature_method': 'HMAC-SHA1', 'oauth_version': '1.0', 'oauth_signature': 'rBMJdn8+n0yXei38tDMfHjYKxyM=', 'oauth_callback': 'oob'}

And the response I'm getting is:

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>400 Bad Request</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Bad Request</h1>
<h2>Your client has issued a malformed or illegal request.</h2>
<h2></h2>
</body></html>

1 Answer 1

1

You don't need to implement handlers, the framework will do that for you. All you need to do is to use the oauth.get_current_user() and everything will be handled for you from the server perspective.

Also you don't suppose to put the secret in the client (I don't know even if GAE give you any access to the secret).

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your response, but I'm still very far from the point I have to check authorization with a controller. I'm failing when the client tries to obtain a request token, that is, the first ever request in the process: see my edit of the original question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.