Google Authentication using Tornado Web Framework(Python) -


i using tornado web framework its's asynchronous call facilities, , trying setup google authentication using oauth in tornado.

currently authentication goes step ask permissions access data , no data received screen comes not able exchange access token application.

can update question code ?? can update answer based on error or code update.

if want refer docs u can @ http://tornado.readthedocs.org/en/latest/auth.html

below example code you.

class googleoauth2loginhandler(tornado.web.requesthandler,                                tornado.auth.googleoauth2mixin):     @tornado.gen.coroutine     def get(self):         if self.get_argument('code', false):             user = yield self.get_authenticated_user(                 redirect_uri='http://your.site.com/auth/google',                 code=self.get_argument('code'))             # save user e.g. set_secure_cookie         else:             yield self.authorize_redirect(                 redirect_uri='http://your.site.com/auth/google',                 client_id=self.settings['google_oauth']['key'],                 scope=['profile', 'email'],                 response_type='code',                 extra_params={'approval_prompt': 'auto'}) 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -