#NEWLINE# @ cherrypy . expose #NEWLINE# def code_flow( self , **kwargs ) : #NEWLINE# #INDENT# if ( 'error' in kwargs ) : #NEWLINE# #INDENT# raise cherrypy . HTTPError ( 500 , '{}: {}' . format ( kwargs [ 'error' ] , kwargs [ 'error_description' ] ) ) #NEWLINE# #UNINDENT# qs = cherrypy . request . query_string #NEWLINE# auth_response = self . rp . parse_authentication_response ( cherrypy . session , qs ) #NEWLINE# auth_code = auth_response [ 'code' ] #NEWLINE# token_response = self . rp . make_token_request ( cherrypy . session , auth_code ) #NEWLINE# userinfo = self . rp . make_userinfo_request ( cherrypy . session , token_response [ 'access_token' ] ) #NEWLINE# html_page = self . _load_HTML_page_from_file ( 'htdocs/success_page.html' ) #NEWLINE# return html_page . format ( auth_code , token_response [ 'access_token' ] , token_response [ 'id_token' ] , userinfo )