authlib / example-oauth2-server

Example for OAuth 2 Server for Authlib.
https://authlib.org/
684 stars 285 forks source link

use a wrong token to api , errors are follows , can you tell me what is wrong?How to response correct? #83

Open yangjinghit opened 3 years ago

yangjinghit commented 3 years ago

flask version >=2.0.0 Traceback (most recent call last): File "/usr/local/python3/lib/python3.7/site-packages/flask/app.py", line 1704, in make_response rv = self.response_class.force_type(rv, request.environ) # type: ignore # noqa: B950 File "/usr/local/python3/lib/python3.7/site-packages/werkzeug/wrappers/response.py", line 263, in force_type response = Response(*run_wsgi_app(response, environ)) File "/usr/local/python3/lib/python3.7/site-packages/werkzeug/test.py", line 1231, in run_wsgi_app app_rv = app(environ, start_response) File "/usr/local/python3/lib/python3.7/site-packages/werkzeug/exceptions.py", line 221, in call response = t.cast("WSGIResponse", self.get_response(environ)) File "/usr/local/python3/lib/python3.7/site-packages/werkzeug/exceptions.py", line 209, in get_response headers = self.get_headers(environ, scope) TypeError: get_headers() takes from 1 to 2 positional arguments but 3 were given

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/python3/lib/python3.7/site-packages/flask/app.py", line 2051, in wsgi_app response = self.full_dispatch_request() File "/usr/local/python3/lib/python3.7/site-packages/flask/app.py", line 1502, in full_dispatch_request return self.finalize_request(rv) File "/usr/local/python3/lib/python3.7/site-packages/flask/app.py", line 1521, in finalize_request response = self.make_response(rv) File "/usr/local/python3/lib/python3.7/site-packages/flask/app.py", line 1711, in make_response ).with_traceback(sys.exc_info()[2]) File "/usr/local/python3/lib/python3.7/site-packages/flask/app.py", line 1704, in make_response rv = self.response_class.force_type(rv, request.environ) # type: ignore # noqa: B950 File "/usr/local/python3/lib/python3.7/site-packages/werkzeug/wrappers/response.py", line 263, in force_type response = Response(*run_wsgi_app(response, environ)) File "/usr/local/python3/lib/python3.7/site-packages/werkzeug/test.py", line 1231, in run_wsgi_app app_rv = app(environ, start_response) File "/usr/local/python3/lib/python3.7/site-packages/werkzeug/exceptions.py", line 221, in call response = t.cast("WSGIResponse", self.get_response(environ)) File "/usr/local/python3/lib/python3.7/site-packages/werkzeug/exceptions.py", line 209, in get_response headers = self.get_headers(environ, scope) TypeError: get_headers() takes from 1 to 2 positional arguments but 3 were given The view function did not return a valid response. The return type must be a string, dict, tuple, Response instance, or WSGI callable, but it was a _HTTPException.

flask == 1.1.4 {"error": "invalid_token", "error_description": "The access token provided is expired, revoked, malformed, or invalid for other reasons."}

what is the difference??

voldikss commented 2 years ago

Upgrade authlib

pip install authlib --upgrade