I'm following this tutorial https://django-oauth-toolkit.readthedocs.io/en/latest/tutorial/tutorial_01.html, and unfortunately I'm stuck in this part
"Point your browser to //localhost:8000/o/applications/ and add an Application instance"
unfortunately when I go to that URL, I get the following error and redirected to
"localhost:8000/accounts/login/?next=/o/applications/"
and page not found error, is there something I'm doing wrong?
The guide doesn't mention it but you need an authenticated session before you can access that page. Add the following steps:
Create a user:
python manage.py createsuperuser
Start up the django server:
python manage.py runserver
Get a validated session by logging into the admin page with the admin account that you just created:
http://localhost:8000/admin
Then navigate to the page the guide references:
http://localhost:8000/o/applications/
Related
I am setting up FreeIPA and Keycloak for user authentication for a django webapp. I have set up the client id and client secret in the .bashrc file and have included my path properly in django (the website loads, just not properly).
The error displayed is "We're sorry, Client not found." I figure this may have something to do with setup.
What should I do to fix this and make the ipa/keycloak login show the login fields?
I figured out my answer by looking at the settings from this post: mozilla-django-oidc with keycloak on django 3
These were the two lines I needed to add in my settings.py:
OIDC_RP_CLIENT_ID = 'my_client_id'
OIDC_RP_CLIENT_SECRET = os.environ.get("my_client_secret")
I am using django to create a web app and add facebook login in the homepage. But whenever I run click on the facebook login link, I get the following error. Can anyone tell me where the error is and how I can fix it ?
Go to facebook developers.
Select your app.
On the left menu choodse Facebook login -> Settings.
In the "Valid OAuth redirect URI's" enter the proper URL.
It your site is https://example.com and you registerd all_auth app url's under /accounts the default callback URL should look like this:
https://example.com/accounts/facebook/login/callback/
I'm using Django-Allauth, but when I upload my project in the server and click on the button to login via Google or Facebook, I redirect to http://127.0.0.1:8001/accounts/google/login/callback/?state=*****
instead of http://example.com/accounts/google/login/callback/?state=*****
I am newbie, so please help me in-depth step by step.
In django admin, update your Site object's domain to your server's ip or your domain name.
I'm having trouble associating Soundcloud accounts to user accounts on my app.
The app is built on django using python-social-auth, and I also have a Facebook association, which is working perfectly.
When I click on the soundcloud button, it redirects me to
http://local.gl.com:8080/?error=redirect_uri_mismatch&error_description=The+redirection+URI+provided+does+not+match+a+pre-registered+value.&state=OBclf3I3ODoKKD5uRdD97AozInK1iUF2#
and nothing happens.
local.gl.com is mapped to my development server address on /etc/hosts
my redirection URI on the soundcloud developers page is
http://local.gl.com:8080/ and on my settings.py I have:
SOCIAL_AUTH_NEW_USER_REDIRECT_URL = '/users/register/'
SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/'
On the .html file I have
soundcloud
Which is basically the same thing I'm using for Facebook, which is working.
I've tried everything that I could find on SO, including registering a new app with soundcloud but I always get the same error.
Any suggestions?
I just had to change the redirect URI on soundcloud page to
http://local.gl.com:8080/complete/soundcloud/
I had already tried that but I had a different error on the settings.py that I hadn't realised, so I was also getting an error with that uri
I have multiple users in django auth setup and a few simple models.
For superusers I can view my model objects. For non superusers that have is_staff checked I get
a 403 Permission denied when trying to view my models.
I have tried adding all permissions to those users to find out if that was the cause but still receive the forbidden message. Other than making them superusers I can't assign any more permissions.
On the command line where I'm running the development server I see messages like
"GET /admin/bcp/buildingsensor/24/ HTTP/1.1" 403 190614
Does anyone know how to get a more useful traceback for this so I know where to start looking. ?
Thanks
In the end, I add debug and traceback directly into the Django source.
I manage to trace it back to:
if not self.has_change_permission(request, obj):
raise PermissionDenied
This reminded me I had overridden has_change_permission(self, request, obj=None) in my model.
If you're using Firefox (or any browser) with Web Developer Toolbar, make sure you have cookies enabled. I temporarily had cookies turned off and forgot to turn it back on.
Cookies => Disable Cookies => Disable All Cookies
Solved my problem in Django 1.9.