Django-oauth-toolkit sends messages to various signals, depending on the action that has been triggered.

You can easily import signals from oauth2_provider.signals and attach your own listeners.

For example:

  1. from oauth2_provider.signals import app_authorized
  2. def handle_app_authorized(sender, request, token,**kwargs):
  3. print('App {} was authorized'.format(
  4. app_authorized.connect(handle_app_authorized)

Currently supported signals are:

  • oauth2_provider.signals.app_authorized - fired once an oauth code has been authorized and an access token has been granted