#NEWLINE# def index( ) : #NEWLINE# #INDENT# '\n    Exchange a <code, client_id, client_secret, redirect_uri> for an access\n    token.\n    ' #NEWLINE# from oauth.storage import web2pyStorage as storage #NEWLINE# storage = storage ( ) #NEWLINE# storage . connect ( ) #NEWLINE# oauth = OAuth2 ( refresh ) #NEWLINE# response . headers [ 'Content-Type' ] = json_headers ( ) #NEWLINE# response . view = json_service ( ) #NEWLINE# ( token , refresh , expires ) = oauth . grant_access_token ( request . get_vars ) #NEWLINE# return meta_data ( CODES [ 'ok' ] , MESSAGES [ 'ok' ] , dict ( access_token = token , token_type = 'Bearer' , expires_in = expires , refresh_token = refresh ) )