views:

326

answers:

0

Hi I am trying to follow the Tweepy App Engine OAuth Example app in my app but am running into trouble.

Here is a link to the tweepy example code: http://github.com/joshthecoder/tweepy-examples Specifically look at: http://github.com/joshthecoder/tweepy-examples/blob/master/appengine/oauth_example/handlers.py

Here is the relevant snippet of my code [Ignore the spacing problems]:

    try:
  authurl = auth.get_authorization_url()
  request_token = auth.request_token
  db_user.token_key = request_token.key
  db_user.token_secret = request_token.secret
  db_user.put()
except tweepy.TweepError, e:
  # Failed to get a request token
  self.generate('error.html', {
    'error': e,
  })
  return


self.generate('signup.html', {
  'authurl': authurl,
  'request_token': request_token,
  'request_token.key': request_token.key,
  'request_token.secret': request_token.secret,
})

As you can see my code is very similar to the example. However, when I compare the version of the request_token.key and request_token.secret that are rendered on my signup page

I.e. the variables I output to the browser:

request_token.key
request_token.secret

Are not the same as the data stored in the datastore:

db_user.token_key = request_token.key
db_user.token_secret = request_token.secret
db_user.put()

As an example here is what I am seeing when testing:

Printed to the screen:

request_token.key: MocXJxcqzDJu6E0yBeaC5sAMSkEoH9NxrwZDDvlVU
request_token.secret: C7EdohrWVor9Yjmr58jbObFmWj0GdBHMMMrIkU8Fds

Values in the datastore:

token_key: 4mZQc90GXCqcS6u1LuEe60wQN53A0fj7wdXHQrpDo
token_secret: dEgr8cvBg9jmPNhPV55gaCwYw5wcCdDZU4PUrMPVqk

Any guidance on what I am doing wrong here?

Thanks!

Reference Links: