500 Response: authenticate() takes exactly 0 arguments (2 given)
See original GitHub issueI’m trying to plug this module into askbot and I continue getting an error on authenticate() takes exactly 0 arguments (2 given)
which does not make much sense to me since the method clearly is asking for two args. Any help is much appreciated since I’m at my limits here.
Settings
# checkout the documentation for more settings
AUTH_ADFS = {
'TENANT_ID': 'TENANT_ID',
'CLIENT_ID': 'AZURE_CLIENT_ID',
'CLIENT_SECRET': 'AZURE_CLIENT_SECRET',
'RELYING_PARTY_ID': 'AZURE_CLIENT_ID',
'AUDIENCE': 'microsoft:identityserver:unique-name',
'CLAIM_MAPPING': {'first_name': 'given_name',
'last_name': 'family_name',
'email': 'email'},
'REDIR_URI': 'https://CSRF_DOMAIN/oauth2/login',
}
Python 2.7, Django 1.8 failure:
Request Method: | GET
-- | --
https://url.com/oauth2/callback?code=lotsofalphnumericcharaterslikeakeyhere&state=Lw%3d%3d&session_state=123c85a7-1234-1234-21c6-12a9a96e123a
1.8.19
TypeError
authenticate() takes exactly 0 arguments (2 given)
/usr/local/lib/python2.7/dist-packages/django_auth_adfs/views.py in get, line 34
/usr/local/bin/uwsgi
2.7.12
['.', '', '/usr/local/lib/python2.7/dist-packages/pip-19.0.3-py2.7.egg', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '.', '/usr/local/lib/python2.7/dist-packages/askbot/deps']
Thu, 21 Feb 2019 03:55:07 +0000
Issue Analytics
- State:
- Created 5 years ago
- Comments:7
Top Results From Across the Web
500 Response: authenticate() takes exactly 0 arguments (2 given ...
I'm trying to plug this module into askbot and I continue getting an error on authenticate() takes exactly 0 arguments (2 given) which...
Read more >Django TypeError: authenticate() takes exactly 0 arguments (3 ...
In 1.10 authenticate does not take positional arguments (docs) call it as authenticate(username=request.POST['username'], password=request.
Read more >authenticate() takes exactly 0 arguments (2 given)
in Django 1.1.1, python 2.6, and I get this error: TypeError at /login/ authenticate() takes exactly 0 arguments (2 given)
Read more >HTTP 500 error from POST reuqest to django vai WSGI and ...
Exception Type: TypeError at /auth/post_authentication_api Exception Value: post_authentication_api() takes exactly 2 arguments (1 given).
Read more >Admin Authentication API Errors | Firebase - Google
An invalid argument was provided to an Authentication method. The error message should contain additional information. auth/invalid-claims, The custom claim ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It looks like it’s because in Django 1.8 the signature of
authenticate
was different.https://github.com/django/django/blob/c686dd8e6bb3817bcf04b8f13c025b4d3c3dc6dc/django/contrib/auth/__init__.py#L62
And it looks like it’s a missing test in the test suite.
Anyway, Django 1.8 is EOL since April 1, 2018. So you might want to look into upgrading. Same for your python version. Python 2 will be deprecated in a couple of months. https://pythonclock.org/
Thanks again @jobec, creating that change in views.py worked, after I adjusted my azure ad settings again, I ended up needing to pass in my client id to CLIENT_ID, RELYING_PARTY_ID, and AUDIENCE. There was a strange issue with the template for login_failed.html not being installed with pip too so I just manually added a file there.