#NEWLINE# def get_user_info_after_auth( request ) : #NEWLINE# #INDENT# flow = get_flow ( request . session [ 'google-redirect-url' ] ) #NEWLINE# del request . session [ 'google-redirect-url' ] #NEWLINE# code = request . GET [ 'code' ] #NEWLINE# credentials = flow . step2_exchange ( code ) #NEWLINE# id_token = credentials . id_token #NEWLINE# if ( not id_token [ 'email_verified' ] ) : #NEWLINE# #INDENT# raise Exception ( 'email address with Google not verified' ) #NEWLINE# #UNINDENT# email = id_token [ 'email' ] #NEWLINE# http = httplib2 . Http ( '.cache' ) #NEWLINE# http = credentials . authorize ( http ) #NEWLINE# ( resp_headers , content ) = http . request ( 'https://www.googleapis.com/plus/v1/people/me' , 'GET' ) #NEWLINE# response = json . loads ( content ) #NEWLINE# name = response [ 'displayName' ] #NEWLINE# return { #NEWLINE# #INDENT# 'type' : 'google' , #NEWLINE# 'user_id' : email , #NEWLINE# 'name' : name , #NEWLINE# 'info' : { #NEWLINE# #INDENT# 'email' : email , #NEWLINE# #UNINDENT# } , #NEWLINE# 'token' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# }