def dispatch(self, request):
    '\n        View to handle final steps of OAuth based authentication where the user\n        gets redirected back to from the service provider\n        '
    login_done_url = reverse((self.adapter.provider_id + '_callback'))
    client = self._get_client(request, login_done_url)
    if (not client.is_valid()):
        if ('denied' in request.GET):
            return HttpResponseRedirect(reverse('socialaccount_login_cancelled'))
        extra_context = dict(oauth_client=client)
        return render_authentication_error(request, extra_context)
    app = self.adapter.get_provider().get_app(request)
    try:
        access_token = client.get_access_token()
        token = SocialToken(app=app, token=access_token['oauth_token'], token_secret=access_token['oauth_token_secret'])
        login = self.adapter.complete_login(request, app, token)
        token.account = login.account
        login.token = token
        login.state = SocialLogin.unmarshall_state(request.session.pop('oauth_login_state', None))
        login.redirect_account_url = request.session.pop('redirect_account_url', None)
        return complete_social_login(request, login)
    except OAuthError:
        return render_authentication_error(request)
View to handle final steps of OAuth based authentication where the user
gets redirected back to from the service provider
def dispatch(self, request):
    '\n        View to handle final steps of OAuth based authentication where the user\n        gets redirected back to from the service provider\n        '
    login_done_url = reverse((self.adapter.provider_id + '_callback'))
    client = self._get_client(request, login_done_url)
    if (not client.is_valid()):
        if ('denied' in request.GET):
            return HttpResponseRedirect(reverse('socialaccount_login_cancelled'))
        extra_context = dict(oauth_client=client)
        return render_authentication_error(request, extra_context)
    app = self.adapter.get_provider().get_app(request)
    try:
        access_token = client.get_access_token()
        token = SocialToken(app=app, token=access_token['oauth_token'], token_secret=access_token['oauth_token_secret'])
        login = self.adapter.complete_login(request, app, token)
        token.account = login.account
        login.token = token
        login.state = SocialLogin.unmarshall_state(request.session.pop('oauth_login_state', None))
        login.redirect_account_url = request.session.pop('redirect_account_url', None)
        return complete_social_login(request, login)
    except OAuthError:
        return render_authentication_error(request)