I’m am using OAuth to allow my user to OAuth with Hunch, on my webpage I have a button to allow the user to go to Hunch and enter their details
<form action="/hunch" method="post" align = "right">
<div>
<input type="submit" value="Login using Hunch">
</div>
</form>
How can I call a method here rather than a handler? as it is currently calling this:
class hunch(webapp.RequestHandler):
def post(self):
url = 'http://hunch.com/authorize/v1/?app_id=123&next=/get-recs'
self.redirect(url)
logging.info("url2 = " + url2)
auth_token_key = self.request.get('auth_token_key')
logging.info("auth_token_key = " + auth_token_key)
but when I print the url2 it just prints /hunch? I hope this makes sense.
Also should this auth_token_key = self.request.get('auth_token_key') get information from the url that the user is directed to after they have entered their credentials?
Please read the documentation for Hunch OAuth.
Rather than intercepting the form on the backend, send the user directly to
If the user authorizes your application, they will be redirected to the
redirect_urlregistered for your application along with anauth_token_key. For example, an app with aredirect_urlof http://your-domain.com/authorized/ will be redirected toAt this point you can exchange the
auth_token_keyfor anauth_token.The Hunch sample app on Github has an example of how this should be done. The
authorizefunction generates a page asking the user to Hunch connect, and theauthorizedfunction exchanges theauth_token_keyfor anauth_token.