How to properly define GAE's oauth2callback?

前端 未结 1 1874
萌比男神i
萌比男神i 2021-01-15 15:03

The Using GAE / Decorators guide tells me that \"you need to add a specific URL handler to your application to handle the redirection from the authorization server back

1条回答
  •  渐次进展
    2021-01-15 15:30

    This library does not ship in App Engine.

    The version you should be using is google-api-python-client-1.1 hosted on the project download page.

    I believe the version you're referring to is the (somewhat old) version of google-api-python-client included in the App Engine SDK. This is only included to perform simple OAuth 2.0 for appcfg.py and is a stable version for performing this simple task. Though it is in the SDK, it is NOT in the runtime and not endorsed as a current version of google-api-python-client for these reasons.

    I'd also like to note that the article you linked explicitly points to installation instructions.

    UPDATE: As noted there, your WSGI handler should contain the callback from the decorator

    routes = [
        ('/update', UpdatePage),
        (decorator.callback_path, decorator.callback_handler()),
    ]
    update = webapp2.WSGIApplication(routes, debug=True)
    

    and your app.yaml should allow your main handler should either explicitly match the the route in decorator.callback_path

    - url: /oauth2callback
      script: myapp.update
    

    or should just route all remaining requests to your WSGI handler

    - url: /.*
      script: myapp.update
    

    (This second approach would likely warrant adding a 404 catch-all to the WSGI handler.)

    0 讨论(0)
提交回复
热议问题