SuLab / WikiGenomesBase

A configurable codebase for launching organism specific WikiGenomes spinoff applications (e.g. ChlamBase.org) This is a web application framework for creating a model organism database leveraging the taxonomic, genetic and functional data that has been loaded to Wikidata.org by the Gene Wiki Project.
https://chlambase.org/
MIT License
7 stars 4 forks source link

New user oauth issue #126

Open djow2019 opened 6 years ago

djow2019 commented 6 years ago

When a new user tries to get access:

Internal Server Error: /wd_oauth Traceback (most recent call last): File "/home/ubuntu/.virtualenvs/nginx-django/lib/python3.5/site-packages/django/core/handlers/exception.py", line 41, in inner response = get_response(request) File "/home/ubuntu/.virtualenvs/nginx-django/lib/python3.5/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response response = self._get_response(request) File "/home/ubuntu/.virtualenvs/nginx-django/lib/python3.5/site-packages/django/core/handlers/base.py", line 187, in _get_response response = self.process_exception_by_middleware(e, request) File "/home/ubuntu/.virtualenvs/nginx-django/lib/python3.5/site-packages/django/core/handlers/base.py", line 185, in _get_response response = wrapped_callback(request, *callback_args, *callback_kwargs) File "/home/ubuntu/.virtualenvs/nginx-django/lib/python3.5/site-packages/django/utils/decorators.py", line 149, in _wrapped_view response = view_func(request, args, **kwargs) File "./wiki/views.py", line 351, in wd_oauth authentication.continue_oauth(oauth_callback_data=body['url'].encode("utf-8")) File "/home/ubuntu/.virtualenvs/nginx-django/lib/python3.5/site-packages/wikidataintegrator/wdi_login.py", line 206, in continue_oauth self.generate_edit_credentials() File "/home/ubuntu/.virtualenvs/nginx-django/lib/python3.5/site-packages/wikidataintegrator/wdi_login.py", line 146, in generate_edit_credentials self.edit_token = response.json()['query']['tokens']['csrftoken'] KeyError: 'query'

djow2019 commented 6 years ago

image.png

djow2019 commented 6 years ago

Related:

mwoauth.errors.OAuthException: Unexpect request token key b'6dc70e884056b0428c692cb24fc06c13', expected b'4d5a74c4faf5a76772d9f74a3d68d981'.

djow2019 commented 6 years ago

Found the issue! It is either an issue with wdi login or mediawiki.

When you create an account for the first time from CHLAMBASE (clicking authorize to edit -> join media wiki), it DOES NOT auto sign in to WIKIDATA. This is the bug: you should be autosigned in to wikidata after you sign in from media wiki. Thus, it gives the illusion you are signed into mediawiki even though you are not signed into wikidata!

Solutions:

1) From media wiki, sign out then sign in 2) OR From wikidata, sign in

When you create an account for the first time from MEDIAWIKI (selecting create account from homepage), it DOES auto sign in to WIKIDTA. This is correct functionality, and will allow you to immediately get authorization access from chlambase

Workaround:

1) Create account from mediawiki OR wikidata directly (so you are already signed in correctly)

djow2019 commented 6 years ago

@andrewsu

Created a post on the media wiki for developers forums. https://discourse-mediawiki.wmflabs.org/t/creating-new-account-does-not-sign-in-to-other-wiki-websites/666

djow2019 commented 6 years ago

The bug was filed on phabricator.wikimedia.org: https://phabricator.wikimedia.org/T198940

khybiske commented 6 years ago

@djow2019 @andrewsu One of my colleagues (Scott Hefty) wants to make some annotations, but he's getting errors when trying to authorize (log in) with his newly created wikidata account. Any known issues still? He showed me on Skype-screenshare, and he authorizes just like I normally do, but he ultimately gets an error pop up.

djow2019 commented 6 years ago

On the dev site I created a FAQ at the bottom that addresses this potential issue for new users. There is currently a bug where new accounts don't get logged into wikidata. But every subsequent login does. Tell him to navigate to wikidata.org and manually log in, or log out and back in. Then, try reauthorizing on chlambase again. In the future, it shouldn't happen.

  1. It looks like I'm authorized but I still am not. What do I do now? Clear your cache (optional). Then, navigate to WikiData and in the upper right corner, click "log in". Then go back to ChlamBase. If you are authorized, deauthorize. Then, reauthorize on ChlamBase and try to add your annotation again.