问题
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?"
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