def oauth_callback(request, service):
    local_host = utils.get_local_host(request)
    form = forms.OAuth2CallbackForm(service=service, local_host=local_host,
                                    data=request.GET)
    if form.is_valid():
        try:
            user = form.get_authenticated_user()
        except __HOLE__ as e:
            messages.error(request, smart_text(e))
        else:
            auth_login(request, user=user)
            messages.success(request, _('You are now logged in.'))
            return redirect(settings.LOGIN_REDIRECT_URL)
    else:
        for dummy_field, errors in form.errors.items():
            for error in errors:
                messages.error(request, error)
    return redirect('registration:login')
dataset/ETHPy150Open mirumee/saleor/saleor/registration/views.py/oauth_callback