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

Open
#83 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
flask, python

Research direction

Start by reproducing the reported behavior with Flask 2.0 or newer and compare it with Flask 1.1.4, using the traceback and token-response examples as the expected observations. Trace the failing error-handling path and determine what behavior should be preserved for an invalid token; done means the newer Flask setup returns a correct error response without the shown exception.

Written by the indexing model from the issue text.

Description

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??

Dominant language
Python
Stars
705
Forks
279
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from authlib/example-oauth2-server

All issues in authlib/example-oauth2-server

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.