From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "T.V Raman" Newsgroups: gmane.emacs.devel Subject: Re: Making GNUS continue to work with Gmail Date: Fri, 07 Aug 2020 17:53:11 -0700 Message-ID: References: <87v9ienz6c.fsf@gnus.org> <878sf9c69y.fsf@gnus.org> <871rkw62t3.fsf@gnus.org> <87mu36e206.fsf@sinax.be> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35276"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Michael Anckaert , emacs-devel@gnu.org To: Cesar Crusius Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Aug 08 02:53:56 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k4D7S-00093l-CA for ged-emacs-devel@m.gmane-mx.org; Sat, 08 Aug 2020 02:53:54 +0200 Original-Received: from localhost ([::1]:43226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k4D7R-000446-7w for ged-emacs-devel@m.gmane-mx.org; Fri, 07 Aug 2020 20:53:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45178) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k4D6u-0003f2-Vt for emacs-devel@gnu.org; Fri, 07 Aug 2020 20:53:21 -0400 Original-Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:46498) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k4D6r-0006Yw-Vq for emacs-devel@gnu.org; Fri, 07 Aug 2020 20:53:20 -0400 Original-Received: by mail-pl1-x632.google.com with SMTP id k13so1993201plk.13 for ; Fri, 07 Aug 2020 17:53:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=v7VUDpZ8zAAZ99lM1SEGdq4XS+3v0y84W75ZEr+GPSA=; b=hLQBfoXZU4U7n9/WSul9ZpSbFwxoF25nexpUYNXIbOd4uZBF2/PDfReufFwCpnSVgj PH0Y8/DONODtdTN2phEjL1RMS9jJAGjW+eOqgj2R+cD2NOvRii3QETnTVQohmK+KnpG1 V4aXOMztv8wYtG+y/ua86qeoFXJanSu4gknmvZ5IJN76DGi1bsKesbIjxXXec7GbI7kq MCu1irtuB8hZRn/WgY58Icq9TaXNXwlVmZjUa3lEbbN5GGWNYhpl1X5VpxTYOyxNeFTq K7fYTuPWymc4j8buhd+OUlXvdn0JYzpfa8FMW5ASBPX1D4G3Qy/PxfIaMJKObRM5vsrd Hm1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=v7VUDpZ8zAAZ99lM1SEGdq4XS+3v0y84W75ZEr+GPSA=; b=QOA9sf2lan22p/JiRs6hiN1xadThDhxEP0FETmkkezbnTrI2T5bWic9YkcP0r46p7B 059bkzMO1cAS+X4kM9pmTmCpHNF1oo8iWNxKSjeP+xeQfz1fI2I/kKFI2Q9zRNsIITZf QsdkqX00AzGZtyaN1XiL+wQanjdmxRxsNzFCNMuVfNDSLin1JxTVAbO/ThuskAO2Nnzy F01RKFd2Tw+DjyhDth4LuSXxV2Xb8yQKkhinMIff1trQggo4F8kf7xVV17PzTkIR+UVY tKausY+j+3Uv1Obwmbw6nQCSGhYlUQ/cd37CVXVK/h8H1YshaasYmA8/qJ3VRJ0N/p+4 OVTQ== X-Gm-Message-State: AOAM531xhFU/TGNbKJEhTgiWpFxWLa2p0hhrGWF7rsdJzK32O8q2Bc/Y E2rkAaqJNaxobh8+KEeIRMB6Iw== X-Google-Smtp-Source: ABdhPJy+qGCvDYqPVV/fytkI8yuQfVKGQBMz3vrqRt+o5ap5+3bgA1Ph72mzWZge3z8+bfcmyYSh3A== X-Received: by 2002:a17:90a:5b:: with SMTP id 27mr7480872pjb.188.1596847994474; Fri, 07 Aug 2020 17:53:14 -0700 (PDT) Original-Received: from raman-glaptop.localdomain (c-24-4-174-65.hsd1.ca.comcast.net. [24.4.174.65]) by smtp.gmail.com with ESMTPSA id f18sm12989583pfj.35.2020.08.07.17.53.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2020 17:53:12 -0700 (PDT) Original-Received: by raman-glaptop.localdomain (Postfix, from userid 13930) id 4131EC21840; Fri, 7 Aug 2020 17:53:11 -0700 (PDT) In-Reply-To: (Cesar Crusius's message of "Fri, 07 Aug 2020 17:01:46 -0700") Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=raman@google.com; helo=mail-pl1-x632.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -185 X-Spam_score: -18.6 X-Spam_bar: ------------------ X-Spam_report: (-18.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_DEF_DKIM_WL=-7.5, USER_IN_DEF_SPF_WL=-7.5 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:253508 Archived-At: Cesar Crusius writes: Also, as Ceasar points out, different hosting apps vary in this flow. Twitter uses OAuth2 but is easier to configure -- witness twittering-mode. The other wrinkle with the Google Oauth2 flow is that you cannot complete it without resorting to a full-blown JS-powered Web browser, i.e. even if we implemented everything on the emacs side, you would still need to hand a URL to Chrome Or Firefox to get to the screen that generates the allow/deny button. At that point, you'll get the refresh token that you'll need to painfully extract and squirrel away somewhere --- you can then forget about it until at some future point, some unforeseen accident invalidates your refresh token at which point you need to go through the whole flow again. > Michael Anckaert writes: > >> Cesar Crusius writes: >> >>> Richard Stallman writes: >>> >>>> [[[ To any NSA and FBI agents reading my email: please consider ]]] >>>> [[[ whether defending the US Constitution against all enemies, ]]] >>>> [[[ foreign or domestic, requires you to follow Snowden's example. ]]] >>>> >>>> > The person you want to reach out to is probably >>>> > dvratil@kde.org. Here's a relevant blog post from him, about how >>>> > he fixed the Kontact Oauth2 problem: >>>> >>>> > https://www.dvratil.cz/2019/08/kontact-google-integration-issue/ >>>> >>>> Lars, is this something you can do? >>>> >>>> > My auth-source-xoauth2 package "avoids" that by having every user >>>> > do the API key dance with Google, and as a result is rather hard >>>> > to setup. >>>> >>>> Aside from the inconvenience, is there anything about this we simply >>>> cannot ask users to do? Does it require accepting terms that are >>>> unjust and not required for using Gmail itself? >>> >>> I went through the process a long time ago, so I can't answer that >>> with certainty. The current legalese is in the pages here: >>> >>> https://developers.google.com/terms >>> >>> Somebody with a keener legal eye could look at it, but there are >>> certainly more/different terms there. >>> >>> As an aside, it is worth noting that my package is not >>> Gmail-specific. It could be used for the Reddit example given before >>> via similar means: register a project/app in Reddit, get the keys, >>> etc. >>> >>> The crux here is that there needs to be an app - their intent is >>> that the software producer (in this case an "Emacs" or "Gnus") >>> registers an "official" app, and the app manages its secrets in a >>> way compliant with their terms (which we already know is pretty hard >>> for OSS projects). >> >> I've picked up this discussion from the list archives and decided to >> chime in with some information I have. Since I lack the previous >> emails in this discussion, please excuse me replying out of sync. >> >> Including the client ID / secret key in Emacs source code (as >> Thunderbird does) is bad practice. In addition, I believe there might >> be some legal / moral issues with registering an FSF application under >> the Google TOS. >> >> The only suitable alternative would be to have the user register his >> own Google Cloud Project and use that client ID to run the OAUTH2 >> flow. This approach differs in that instead of having one client and >> many users, we have one client for every user. > > This is exactly what the auth-source-xoauth2 package asks the user to do, with documentation on how to do it *for Google projects.* > >> In the past I've written a number of software packages for companies >> that had to make use of Google API's using OAUTH2 authentication. In >> some cases we couldn't include the client secret in those packages >> (various departments had their own Google Cloud projects and API usage >> guidelines). So in essence I had the same issue as what Emacs is >> facing now. >> >> The solution was to have the software prompt the user to create a >> specific project on Google Cloud and specify the client secret in the >> application configuration. A similar approach could be chosen for >> Emacs so that instead of having a single client ID for Emacs, every >> user creates his/her own project and configures the client ID in >> his/her Emacs configuration. Then the OAUTH2 flow has to be run for >> that 'Emacs application'. >> >> The flow as I once implemented it could be adapted to Emacs as follows: >> >> * The Emacs documentation specifies the user what type of Google >> Cloud project has to be created and what client ID / secrets have to >> be configured. >> * After configuring this information, the user starts an Emacs >> command (eg M-x retrieve-oauth-credentials) >> * This command starts a local webserver and opens the address in the user's browser >> * The webpage displayed allows the user to start the OAUTH2 flow >> which redirects to the local webpage with the OAUTH2 token >> * Emacs stores the OAUTH2 token in a suitable location >> >> I would have to check back to some code I have stored to verify the >> entire flow and make sure I didn't miss anything. But in essence the >> flow above is what would be required. >> >> If deemed suitable, I'm willing to aid in development of this feature >> if someone can spend some time mentoring / guiding me on the required >> steps and correct implementation details. > > One worry I have about this is that it wold be very Google-specific, > as there are other places where this is necessary (Reddit came up as > an example) that have a quite different project registration workflow. > > The impression I get from all the discussion is that, in the end, > OAUTH2 is just extremely OSS-unfriendly, and currently there may be no > better solution than simply say "go register a project and generate > the keys" in various levels of detail. > > My personal take on this is that documentation serves the purpose > better, but I'm not against utility functions that guide you through > the setup. I know, for example, that the Google Cloud Developer > console is *extremely* accessibility-unfriendly, to the point of being > unusable (T.V. Raman can correct me here if I'm exaggerating) - the > workflow you sketched above would not solve that problem, as the user > still has to navigate the Google interface to do things. --