Python - Getting url a browser was redirected to

后端 未结 2 783
北荒
北荒 2021-02-06 17:17

I am trying to authenticate an application with the API.
Here\'s How:

  1. I am opening a URL using webbrowser.open.
  2. The user authenticates
2条回答
  •  悲哀的现实
    2021-02-06 18:16

    After the user authenticates with stack exchange, the SE page will redirect back to your page ("redirect_uri" below). Your code currently redirects to https://stackexchange.com/oauth/login_success ; instead, you should redirect to a page you control.

    1. Open a new window at https://stackexchange.com/oauth/dialog, with these query string parameters
      • client_id
      • scope
      • redirect_uri
      • state - optional
    2. The user approves your app
    3. The user is redirected to redirect_uri, with these parameters in the hash
      • access_token
      • expires - optional, only if scope doesn't contain no_expiry

    source: https://api.stackexchange.com/docs/authentication

提交回复
热议问题