auth0-samples / auth0-python-api-samples

Auth0 Integration Samples for Python REST API Services using Flask

Home Page:https://auth0.com/docs/quickstart/backend/python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Auth0 Example is not working

erikpa1 opened this issue · comments

Checklist

  • I have looked into the Readme and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Description

Hi, I'm trying this example:
https://github.com/auth0-samples/auth0-python-api-samples/tree/master/00-Starter-Seed

in python 3.11

and I got error:

Traceback (most recent call last):
  File "C:\Work\exedevelopment\infinity_twin\infinity_twin_backend\venv\Lib\site-packages\flask\app.py", line 2552, in __call__
    return self.wsgi_app(environ, start_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Work\exedevelopment\infinity_twin\infinity_twin_backend\mysocketio.py", line 43, in __call__
    return super(_SocketIOMiddleware, self).__call__(environ,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Work\exedevelopment\infinity_twin\infinity_twin_backend\venv\Lib\site-packages\engineio\middleware.py", line 74, in __call__
    return self.wsgi_app(environ, start_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Work\exedevelopment\infinity_twin\infinity_twin_backend\venv\Lib\site-packages\flask\app.py", line 2532, in wsgi_app
    response = self.handle_exception(e)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Work\exedevelopment\infinity_twin\infinity_twin_backend\venv\Lib\site-packages\flask_cors\extension.py", line 176, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^^^
  File "C:\Work\exedevelopment\infinity_twin\infinity_twin_backend\venv\Lib\site-packages\flask\app.py", line 2529, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Work\exedevelopment\infinity_twin\infinity_twin_backend\venv\Lib\site-packages\flask\app.py", line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Work\exedevelopment\infinity_twin\infinity_twin_backend\venv\Lib\site-packages\flask_cors\extension.py", line 176, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
                                                ^^^^^^^^^^^^^^^^^^^^
  File "C:\Work\exedevelopment\infinity_twin\infinity_twin_backend\venv\Lib\site-packages\flask\app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Work\exedevelopment\infinity_twin\infinity_twin_backend\venv\Lib\site-packages\flask\app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Work\exedevelopment\infinity_twin\infinity_twin_backend\app_init.py", line 95, in login
    return oauth.auth0.authorize_redirect(redirect_uri=url_for("callback", _external=True))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Work\exedevelopment\infinity_twin\infinity_twin_backend\venv\Lib\site-packages\authlib\integrations\flask_client\apps.py", line 43, in authorize_redirect
    rv = self.create_authorization_url(redirect_uri, **kwargs)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Work\exedevelopment\infinity_twin\infinity_twin_backend\venv\Lib\site-packages\authlib\integrations\base_client\sync_app.py", line 309, in create_authorization_url
    metadata = self.load_server_metadata()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Work\exedevelopment\infinity_twin\infinity_twin_backend\venv\Lib\site-packages\authlib\integrations\base_client\sync_app.py", line 293, in load_server_metadata
    with self.client_cls(**self.client_kwargs) as session:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: authlib.integrations.requests_client.oauth2_session.OAuth2Session() argument after ** must be a mapping, not tuple


image

My reqirements:


cryptography==37.0.4
Werkzeug==2.3.7
Flask==2.2.5
pyjwt==2.6.0
requests==2.28.0
asgiref==3.6.0
SQLAlchemy==2.0.21

pillow==9.5.0
#icecream==2.1.3

#numpy==1.26.2
#matplotlib==3.8.1
#fpdf==1.7.2

azure-storage-blob==12.15.0
azure-data-tables==12.4.2

Flask-SQLAlchemy==3.1.1
Flask-SocketIO==5.3.6
Flask-Cors==4.0.0
flask-login==0.6.2
Flask-Bcrypt==1.0.1
websocket-client
pymongo==4.6.0
gevent==23.9.1
openpyxl==3.1.2
pytz==2023.3.post1

authlib>=1.0

#---kvoli icecreamu
pygments==2.17.2
asttokens==2.4.1
#-----------diff---------
pandas==2.0.3

Reproduction

Run the example...

Additional context

In the log there are things like Cors and Socketio, but don't worry I tried this also with disabled ones

My mistake, by accident i left "," coma on the end of function
image