Are you trying to exit the Django application or want to “forget” Twitter access? Typically, the twitter auth token is saved for easier login the next time the user wants to connect to Twitter, so the user does not need to “accept” access again.
Exit Django
If you just want to log out of the Django authorization system, it should be enough to use the django.contrib.auth.views.logout or create a custom logout view.
Social Out
To completely disable / disable a social account, you need to use the disconnect functions in social-auth. You can get the disconnect URL using the following template tag:
{% url "socialauth_disconnect" "backend-name" %}
For more information see http://django-social-auth.readthedocs.org/en/v0.7.22/configuration.html#linking-in-your-templates .
Confirmation Invitation
Since you have already allowed your application access to the OAuth provider, the auth provider will remember this solution. There are usually two ways to forcibly confirm this access:
- Revoke access permission in the management console of your authorization provider (for example, deny access to the Twitter application).
- Specify an optional OAuth argument that prompts an approval prompt. I'm not sure Twitter provides such a thing, but if you use Google OAuth2, you can simply add
{'approval_prompt': 'force'} to the GOOGLE_OAUTH2_AUTH_EXTRA_ARGUMENTS setting.
Danilo bargen
source share