use a wrong token to api , errors are follows , can you tell me what is wrong?How to response correct?
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
- Domain
- api, authentication, backend
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from authlib/example-oauth2-server
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 1/5 Under an hour Newbie friendliness 45/100
authlib/example-oauth2-server#95 · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
authlib/example-oauth2-server#92 · 4 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
authlib/example-oauth2-server#90 · 8 comments ·
All issues in authlib/example-oauth2-server
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100