Hi, Arun

I also making an OAuth consumer with Google App Engine for Python.
The consumer uses simplegeo oauth2 library.
Here is my code snippet to get access token
when called back just after authorization.

....
            user_info.authorized_request_token =
self.request.get("oauth_token")
            user_info.verifier = self.request.get("oauth_verifier")
            assert(user_info.request_token ==
user_info.authorized_request_token)
            request_token =
oauth2.Token(user_info.request_token.__str__(),
user_info.request_token_secret.__str__())
            request_token.set_verifier(user_info.verifier.__str__()) #
may not needed
            request = oauth2.Request.from_consumer_and_token(consumer,
token=request_token, http_url = SP_ACCESS_TOKEN_URL)
            signature_method = oauth2.SignatureMethod_HMAC_SHA1()
            request.sign_request(signature_method, consumer,
request_token)
            #self.response.out.write(request.to_header())
            connection.request(request.method, SP_ACCESS_TOKEN_URL,
headers=request.to_header())
            response = connection.getresponse()
            response_read = response.read()
            access_token = oauth2.Token.from_string(response_read)
            user_info.access_token = access_token.key
            user_info.access_token_secret = access_token.secret
            user_info.put()
....

I hope it helps you somewhat.

Takashi SASAKI (@TakashiSasaki on Twitter)

On 1月29日, 午前1:28, Arun Shanker Prasad <arunshankerpra...@gmail.com>
wrote:
> Hi All,
>
> Background:
>
> I am trying to implement a web-service for my App Engine application
> and authenticate the user using OAuth. For this I chose to use my App
> Engine application as an OAuth service provider.
>
> My issue:
>
> I got the request token back from App Engine and I redirected my user
> to authorize the token and user grants access, everything is working
> fine up until this point. When I try to get the access token using the
> token and verifier provided by posting info to 'https://app-
> id.appspot.com/_ah/OAuthGetAccessToken', I am getting a 400 error back
> and does not have any information regarding what went wrong :(
>
> I had used GData OAuth before on my client application and had similar
> issues during development, but the response from Google's GData
> service had a bit more information as to what was wrong and I was able
> to get it working pretty easily.
>
> My question is has anyone tried using their App Engine application as
> an OAuth service provider? (I tried googling for a sample and was not
> able to find anything)
>
> I am using Google App Engine for Python.
>
> Thanks,
> Arun Shanker Prasad.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to