def get(self, request):
        """
        Called after authorization was granted and the OAuth flow 
        successfully completed. 
        
        Tries to:

        - Connect the remote account if the user is logged in already
        - Log the user in if a local profile of the remote account 
          exists already
        - Create a user and profile object if none of the above succeed
          and redirect the user further to either capture some data via
          form or generate a username automatically
        """
        
        try:
            client = request.session[self.get_client().get_session_key()]
        except KeyError:
            return self.error_to_response(request, {'error': "Session expired."})
        
        # Get the lookup dictionary to find the user's profile
        lookup_kwargs = self.get_lookup_kwargs(request, client)

        # Logged in user (re-)connecting an account
        if request.user.is_authenticated():
            try:
                profile = self.get_profile(**lookup_kwargs)
                
                # Make sure that there is only *one* account per profile.                
                if not profile.user == request.user:
                    self.delete_session_data(request)
                    return self.error_to_response(request, {
                        'error': _('This profile is already connected to another user account.')
                    })
                
            except self.get_model().DoesNotExist: 
                profile, created = self.get_or_create_profile(request.user,
                    save=True, **lookup_kwargs) 

            self.send_connect_signal(request, request.user, profile, client)

            return self.redirect(request)

        # Logged out user - let's see if we've got the identity saved already.
        # If so - just log the user in. If not, create profile and redirect
        # to the setup view 
        
        user = self.authenticate(**lookup_kwargs)
        
        # No user existing - create a new one and redirect to the final setup view
        if user is None:
            if not ALLOW_OPENID_SIGNUPS and self.client is OpenIDClient:
                return self.error_to_response(request, {
                    'error': _('We are not currently accepting new OpenID signups.')
                })
            user = self.create_user()
            profile = self.create_profile(user, **lookup_kwargs)
            
            self.store_user(request, user)
            self.store_profile(request, profile)
            self.store_client(request, client)
            
            return HttpResponseRedirect(reverse('socialregistration:setup'))

        # Inactive user - displaying / redirect to the appropriate place.
        if not user.is_active:
            return self.inactive_response(request)
        
        # Active user with existing profile: login, send signal and redirect
        self.login(request, user)
        
        profile = self.get_profile(user=user, **lookup_kwargs)
        
        self.send_login_signal(request, user, profile, client)
        
        return self.redirect(request)