Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix user Authentication error when on localhost #1723

Closed
NyuydineBill opened this issue Mar 7, 2024 · 9 comments · Fixed by #1739
Closed

Fix user Authentication error when on localhost #1723

NyuydineBill opened this issue Mar 7, 2024 · 9 comments · Fixed by #1739
Labels

Comments

@NyuydineBill
Copy link
Contributor

NyuydineBill commented Mar 7, 2024

After setting up the project on your local machine, you will realize that, you need to be logged in before add a project or any other feature. Now as a sample, it should work like this https://release-monitoring.org/.
But on the contrary you will receive several errors, and get this message on terminal console

[anitya.app ERROR] Exception on /login/fedora/ [GET]
Traceback (most recent call last):
  File "/home/nyuydinebill/.cache/pypoetry/virtualenvs/anitya-8dx-Zgie-py3.10/lib/python3.10/site-packages/flask/app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/nyuydinebill/.cache/pypoetry/virtualenvs/anitya-8dx-Zgie-py3.10/lib/python3.10/site-packages/flask/app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/nyuydinebill/.cache/pypoetry/virtualenvs/anitya-8dx-Zgie-py3.10/lib/python3.10/site-packages/flask/app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/nyuydinebill/.cache/pypoetry/virtualenvs/anitya-8dx-Zgie-py3.10/lib/python3.10/site-packages/flask/app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
  File "/home/nyuydinebill/.cache/pypoetry/virtualenvs/anitya-8dx-Zgie-py3.10/lib/python3.10/site-packages/social_flask/utils.py", line 43, in wrapper
    return func(backend, *args, **kwargs)
  File "/home/nyuydinebill/.cache/pypoetry/virtualenvs/anitya-8dx-Zgie-py3.10/lib/python3.10/site-packages/social_flask/routes.py", line 14, in auth
    return do_auth(g.backend)
  File "/home/nyuydinebill/.cache/pypoetry/virtualenvs/anitya-8dx-Zgie-py3.10/lib/python3.10/site-packages/social_core/actions.py", line 29, in do_auth
    return backend.start()
  File "/home/nyuydinebill/.cache/pypoetry/virtualenvs/anitya-8dx-Zgie-py3.10/lib/python3.10/site-packages/social_core/backends/base.py", line 34, in start
    if self.uses_redirect():
  File "/home/nyuydinebill/.cache/pypoetry/virtualenvs/anitya-8dx-Zgie-py3.10/lib/python3.10/site-packages/social_core/backends/open_id.py", line 233, in uses_redirect
    return self.openid_request().shouldSendRedirect()
  File "/home/nyuydinebill/.cache/pypoetry/virtualenvs/anitya-8dx-Zgie-py3.10/lib/python3.10/site-packages/social_core/backends/open_id.py", line 238, in openid_request
    return self.consumer().begin(url_add_parameters(self.openid_url(),
  File "/home/nyuydinebill/.cache/pypoetry/virtualenvs/anitya-8dx-Zgie-py3.10/lib/python3.10/site-packages/openid/consumer/consumer.py", line 360, in begin
    return self.beginWithoutDiscovery(service, anonymous)
  File "/home/nyuydinebill/.cache/pypoetry/virtualenvs/anitya-8dx-Zgie-py3.10/lib/python3.10/site-packages/openid/consumer/consumer.py", line 383, in beginWithoutDiscovery
    auth_req = self.consumer.begin(service)
  File "/home/nyuydinebill/.cache/pypoetry/virtualenvs/anitya-8dx-Zgie-py3.10/lib/python3.10/site-packages/openid/consumer/consumer.py", line 611, in begin
    assoc = self._getAssociation(service_endpoint)
  File "/home/nyuydinebill/.cache/pypoetry/virtualenvs/anitya-8dx-Zgie-py3.10/lib/python3.10/site-packages/openid/consumer/consumer.py", line 1184, in _getAssociation
    self.store.storeAssociation(endpoint.server_url, assoc)
  File "/home/nyuydinebill/.cache/pypoetry/virtualenvs/anitya-8dx-Zgie-py3.10/lib/python3.10/site-packages/social_core/store.py", line 21, in storeAssociation
    self.assoc.store(server_url, association)
  File "/home/nyuydinebill/.cache/pypoetry/virtualenvs/anitya-8dx-Zgie-py3.10/lib/python3.10/site-packages/social_sqlalchemy/storage.py", line 218, in store
    assoc.secret = base64.encodestring(association.secret).decode()
AttributeError: module 'base64' has no attribute 'encodestring'

Requirements

  • Configure third party packages and allow local server urls
  • Fix the issue regarding the error on terminal

This will enable contributors to access the project and fix the issues they are working on

@Zlopez Zlopez added the vagrant label Mar 7, 2024
@Zlopez
Copy link
Contributor

Zlopez commented Mar 7, 2024

Could you try running it in vagrant, so we can remove the possibility that it's something on your machine. See documentation for instructions.

@NyuydineBill
Copy link
Contributor Author

NyuydineBill commented Mar 7, 2024

@Zlopez I am trying to set-up vagrant environment and getting this, I have tried resolving it but, its not working
Screenshot from 2024-03-07 12-53-03

Also receiving errors related to Unit files not exist

@Zlopez
Copy link
Contributor

Zlopez commented Mar 7, 2024

Did you encountered any error when running vagrant up ?
I'm trying to deploy it on my machine and it's failing for me.

@NyuydineBill
Copy link
Contributor Author

Did you encountered any error when running vagrant up ? I'm trying to deploy it on my machine and it's failing for me.

Yes I kept receiving errors and that was why I used Python virtualenv
it opens the project on python venv, but then user can't authenticate and log in while on local environment

@Freedisch
Copy link
Contributor

Freedisch commented Mar 8, 2024

@NyuydineBill, I had the same issue with Vagrant, but I was able to run the project with docker, u should try running the project with docker it's pretty straight forward just have to run make up I believe that will work

@NyuydineBill
Copy link
Contributor Author

@NyuydineBill, I had the same issue with Vagrant, but I was able to run the project with docker, u should try running the project with docker it's pretty straight forward just have to run make up I believe that will work

OKay @Freedisch Thanks for reaching out
I finally resolved the issue, I have used python venv. The directions to anyone using Python virtual env and facing similar problem are in a PR just created

@Zlopez
Copy link
Contributor

Zlopez commented Mar 8, 2024

I'm trying to solve the error when setting up dev env. It should be solved soon.

NyuydineBill added a commit to NyuydineBill/anitya that referenced this issue Mar 8, 2024
This commit adds optional instructions for configuring social_sqlalchemy, a package for SQLAlchemy storage support for Python Social Auth, in Flask applications. It provides a code example demonstrating how to set up social_sqlalchemy in a Flask app, including configuring the SQLAlchemy database and initializing social_sqlalchemy. Additionally, it includes a note on starting the development web server with Flask.

These instructions are added to the contributing.rst file under the Python Virtualenv section to provide guidance to contributors who may want to use social_sqlalchemy for OAuth and OAuth2 authentication in their Flask applications.

Resolves: #issue_number:fedora-infra#1723
NyuydineBill added a commit to NyuydineBill/anitya that referenced this issue Mar 8, 2024
This commit adds optional instructions for configuring social_sqlalchemy, a package for SQLAlchemy storage support for Python Social Auth, in Flask applications. It provides a code example demonstrating how to set up social_sqlalchemy in a Flask app, including configuring the SQLAlchemy database and initializing social_sqlalchemy. Additionally, it includes a note on starting the development web server with Flask.

These instructions are added to the contributing.rst file under the Python Virtualenv section to provide guidance to contributors who may want to use social_sqlalchemy for OAuth and OAuth2 authentication in their Flask applications.

Resolves: #issue_number:fedora-infra#1723
@Zlopez
Copy link
Contributor

Zlopez commented Mar 8, 2024

Fixed the vagrant environment for Anitya with one bug I encountered during login.

@Zlopez
Copy link
Contributor

Zlopez commented Mar 8, 2024

And I fixed the container dev environment as well. PR is here.

@Zlopez Zlopez linked a pull request Mar 12, 2024 that will close this issue
@mergify mergify bot closed this as completed in #1739 Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants