FusionAuth / fusionauth-python-client

FusionAuth Python Client
https://fusionauth.io
Apache License 2.0
24 stars 12 forks source link

Bug, missing requirements #18

Closed FreyaAmiga closed 2 years ago

FreyaAmiga commented 2 years ago

Not sure if this is a needed part. Commenting this part out makes it run okay, but hey, not sure what I'm missing. The documentation of the Python code is lacking on your website.

[2022-08-11 09:16:40,469] ERROR in app: Exception on /oauth-callback [GET] Traceback (most recent call last): File "/home/michael/git/fusionauth-example-python-flask/venv/lib/python3.8/site-packages/flask/app.py", line 2525, in wsgi_app response = self.full_dispatch_request() File "/home/michael/git/fusionauth-example-python-flask/venv/lib/python3.8/site-packages/flask/app.py", line 1822, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/michael/git/fusionauth-example-python-flask/venv/lib/python3.8/site-packages/flask/app.py", line 1820, in full_dispatch_request rv = self.dispatch_request() File "/home/michael/git/fusionauth-example-python-flask/venv/lib/python3.8/site-packages/flask/app.py", line 1796, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) File "/home/michael/git/fusionauth-example-python-flask/app/views.py", line 75, in oauth_callback if registrations is None or len(registrations) == 0 or not any(r["applicationId"] == client_id for r in requirements): NameError: name 'requirements' is not defined

mooreds commented 2 years ago

Thanks @FreyaAmiga , that looks like a typo in https://github.com/FusionAuth/fusionauth-example-python-flask/blob/master/app/views.py

Should be

    if registrations is None or len(registrations) == 0 or not any(r["applicationId"] == client_id for r in registrations):

Can you try that and let me know if it works? I'll update the sample code if so.

FreyaAmiga commented 2 years ago

Hi Dan, I simply rewrote the whole code to my own liking; https://github.com/FreyaAmiga/FlaskWithFusionAuth Thanks for the answer though, I might check this tonight if there is some time for that :) Regards, Michael

mooreds commented 2 years ago

Ah, awesome. Looks like you are using this pattern in your code: https://fusionauth.io/learn/expert-advice/authentication/webapp/native-login-form-to-application-backend-sessions

Which is a perfectly fine authentication pattern, but has some consequences in terms of scalability which may or may not be a concern.

Thanks for using FusionAuth!

mooreds commented 2 years ago

Closing because I fixed the typo. Thanks again @FreyaAmiga for reporting!