code: def application_unauthenticated(request, token, state=None, label=None):
      
      application = base.get_application(secret_token=token)
      if application.expires < datetime.datetime.now():
          return render(
              template_name='kgapplications/common_expired.html',
              context={'application': application},
              request=request)
  
      roles = {'is_applicant', 'is_authorised'}
  
      # redirect user to real url if possible.
      if request.user.is_authenticated:
          if request.user == application.applicant:
              url = base.get_url(
                  request, application, roles, label)
              return HttpResponseRedirect(url)
  
      state_machine = base.get_state_machine(application)
      return state_machine.process(
          request, application, state, label, roles)
docs: An somebody is trying to access an application.