<s> def index ( ) : <EOL> """<STR_LIT>""" <EOL> from oauth . storage import web2pyStorage as storage <EOL> storage = storage ( ) <EOL> storage . connect ( ) <EOL> oauth = OAuth2 ( storage ) <EOL> params = dict ( ) <EOL> success = False <EOL> try : <EOL> params = oauth . validate_authorize_params ( request . get_vars ) <EOL> except Exception as ex : <EOL> redirect ( URL ( c = '<STR_LIT:error>' , vars = dict ( msg = ex ) ) ) <EOL> if request . post_vars : <EOL> success = True <EOL> if request . post_vars [ '<STR_LIT>' ] == '<STR_LIT>' : <EOL> user_id = '<STR_LIT>' <EOL> code = oauth . storage . add_code ( request . post_vars [ '<STR_LIT>' ] , <EOL> user_id , <EOL> oauth . config [ oauth . CONFIG_CODE_LIFETIME ] ) <EOL> redirect ( request . get_vars [ '<STR_LIT>' ] + '<STR_LIT>' + code ) <EOL> else : <EOL> redirect ( request . get_vars [ '<STR_LIT>' ] + '<STR_LIT>' ) <EOL> url = '<STR_LIT>' <EOL> try : <EOL> client_id = params [ '<STR_LIT>' ] <EOL> redirect_uri = params [ '<STR_LIT>' ] <EOL> the_scope = params [ '<STR_LIT>' ] <EOL> response_type = params [ '<STR_LIT>' ] <EOL> access_type = params [ '<STR_LIT>' ] <EOL> url = '<STR_LIT:?>' + '<STR_LIT>' + client_id + '<STR_LIT>' + redirect_uri + '<STR_LIT>' + response_type + '<STR_LIT>' + access_type <EOL> print '<STR_LIT>' , url <EOL> except Exception as ex : <EOL> redirect ( URL ( c = '<STR_LIT:error>' , vars = dict ( msg = ( ex . msg or ex ) ) ) ) <EOL> return locals ( ) </s>
