python - Why do I get "redirect_uri_missmatch"? -
I am trying to authorize to use I think there is something wrong with my request because I have no < Code> redirect_uri does not match error.
I redirect Yuri uras: ietf: wg: oauth: 2.0: Oob and this is a basic application from my project.
The login page authorizes the user from Google and / oauth2callback is taking information from a submitted form with Google generated code. Code is
@ app.route ('/ login') DEF login (): flow = OAuth2WebServerFlow (client_id = CLIENT_ID, client_secret = CLIENT_SECRET, scope = 'https: //www.googleapis. Com / auth / calendar ', redirect_uri =' variant: ietf: wg: oauth: 2.0: oob ', approval_propp =' force ', access_type =' offline ') auth_uri = flow.step1_get_authorize_url () Return Redirect (auth_uri) @app Code = request.form ['code'] If code: # authorization code flow for user credential flow = OAuth2WebServerFlow (CLIENT_ID, '/ Oauth2callback', methods = ['POST', 'GET']) def oauth2callback () CLIENT_SECRET, scope = "https://www.googleapis.com/auth/calendar", redirect_uri = 'cache: IETF: wg: oauth: 2.0: oo B ') try flow.redirect_uri = request.bas E_url: Credentials = Flow.Step 2_changes (code) Storage = storage (' credentials.tv ') storage.put except the exceptions (credentials) E: logging. Warning ("Unable to get login token because" + e.message) Return Redirect ('/')
Comments
Post a Comment