Tweeter Oauth:You are authenticated as XXX, but are not authorized to access this page. Would you like to login to a different account?

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-27 17:09:31

问题


I have created just a simple django app to login using tweeter, but when i try to login from my app I get this message "You are authenticated as xxx, but are not authorized to access this page. Would you like to login to a different account?"

Screenshot showing message

I have tried to login with account I used to create the app and different account, but the result is the same. What could be the solution to this?

I am using django and django-allauth library


回答1:


To access the Django admin, the user needs is_staff=True. If you log into the admin with a superuser, you can edit your testmyap user and set the flag.

If you have not yet created a superuser, you can create one with:

python manage.py createsuperuser



回答2:


On the terminal type:

$ python manage.py shell
$ from django.contrib.auth.models import User
$ u = User.objects.get(username='testmyapp')
$ u.is_superuser = True
$ u.save()
$ quit()
$ python manage.py runserver


来源:https://stackoverflow.com/questions/45191733/tweeter-oauthyou-are-authenticated-as-xxx-but-are-not-authorized-to-access-thi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!