From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: [GNU ELPA] New package: url-http-oauth Date: Mon, 8 May 2023 08:50:06 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000e4eea905fb29e3dc" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2711"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Thomas Fitzsimmons Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon May 08 09:51:39 2023 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 1pvvek-0000Yy-JN for ged-emacs-devel@m.gmane-mx.org; Mon, 08 May 2023 09:51:38 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pvvdd-0005BD-JB; Mon, 08 May 2023 03:50:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pvvdb-0005Am-FC for emacs-devel@gnu.org; Mon, 08 May 2023 03:50:27 -0400 Original-Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pvvdV-0006p3-JZ for emacs-devel@gnu.org; Mon, 08 May 2023 03:50:25 -0400 Original-Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-6ab074ef787so195753a34.0 for ; Mon, 08 May 2023 00:50:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683532219; x=1686124219; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ltHBIbM5fg3G9vP0m/gnNXLSmdueSdJH0Yhule1JUd0=; b=GsB5wDhEHofzoc0bUZGXtTt5MnGiMWk4NFXYxElSDfxXvJsU9zvohQUcGgVff7eRp4 MsGLPbMHtYr5alEYjMcC46EYrxUmj8FldglYPTx6fSlgWgv5fEtubAtTgyBElJtH5thq UM16ZIeOyqCkOsJ6BIU1ow+8WT4b1DTzirp4Pww3GSHNy/SC0T2FCKXO3o4Axrjy6rP4 XgxjPb9jMtehozNzmn99lvvoBHqX8D8pZRHVFzOIc99MM0i63oS3gweunaMXfMe4PH1I jeWAbs0XXKIfKd3qxcTfNV7EQI+cTwaBD7DIPl0KtVCOEe4CSid8Si0mrz/ZaRAkkToB WLCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683532219; x=1686124219; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ltHBIbM5fg3G9vP0m/gnNXLSmdueSdJH0Yhule1JUd0=; b=K3etg7Z7VkM4aULtWv2hefTjan/MYcHdyM1H0QS2lHunuM3QVF2st8i3e5Wdn8AA2p URHkwvVNjlGwg43Ywr2nUjYahiOC5JLf5vXv7dZN1W7cuFhVMYGuB8o5Eo4zuwb5IkUR DbVjDscyWbIGJ6pISf6GuBtPNZu7E4xLsNOd1GdLx6qS7v/uTy5nW+grRMrN4Uopx/cl UlbhC691q7qXuWLuTI2sXQMMbuyf3QcEx+elXRbDnCpf40/vRgOo41IVRg5fw+ZZTsMz EYbzhSDiCIsSVqvSn1NipioQn8bLfV4NTe66/jv7c2c57B4CZsQjwEhXQgLrgovFaZPi k4ww== X-Gm-Message-State: AC+VfDxMY/5IA2wBECbmjNNmi9H3EdKKfR3VEdlP3L/Eh985tWBBzsJF zHNhasWiLiPUS00KACinuzHecpVHct1L0uNHDJU= X-Google-Smtp-Source: ACHHUZ5OKGTfWTxuOFf7SUYFjw6a3QwA4QnZ/ZDY2ktw2vMHMjafzbO3LOfxU6ASvwv50B8enBDCrwTwvL8/gHflTzk= X-Received: by 2002:a05:6808:3d4:b0:389:4f86:205e with SMTP id o20-20020a05680803d400b003894f86205emr4213988oie.9.1683532219213; Mon, 08 May 2023 00:50:19 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::32d; envelope-from=joaotavora@gmail.com; helo=mail-ot1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:305970 Archived-At: --000000000000e4eea905fb29e3dc Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I think packages such as this one are very welcome, and I appreciate the UI-agnostic architecture you describe. Url.el itself, last i looked, seemed a bit outdated and hard to work with. Are there other http client libraries for Emacs? Could they also take advantage of your new library? Jo=C3=A3o On Sat, May 6, 2023, 06:07 Thomas Fitzsimmons wrote: > Hi, > > I would like to add one or two new packages to GNU ELPA. > > The main one is url-http-oauth, which adds OAuth 2.0 support to the URL > library, via "url-auth" hooks, like url-http-basic, url-http-digest and > url-http-ntlm. It provides auth-source integration for secrets, using > the netrc backend. > > https://git.sr.ht/~fitzsim/url-http-oauth > > This package is unrelated to oauth2.el in GNU ELPA, which provides new > oauth2-url-retrieve and oauth2-url-retrieve-synchronously functions, and > has plstore instead of auth-source integration. For Excorporate, I > needed something that would work with the built-in url-retrieve > functions and I couldn't see how to do that with oauth2.el. I haven't > tested, but I see no reason that the two packages would interfere with > one another. > > For the next release of Excorporate I want to depend on url-http-oauth > to fix the longstanding bug#50113, "Excorporate: Communicating with > domain that requires SSO?". I have the changes ready; I am using them > daily. > > The OAuth 2.0 standard encodes the use of a user-agent (i.e., web > browser) for authorization steps which differ per OAuth 2.0 provider, > and are not defined by the specification. I have provided support for > package authors and users to write custom functions to automate these > web browser interactions in arbitrary ways: > > AUTHORIZATION-CODE-FUNCTION is an elisp function that takes an > authorization URL as a string argument, and returns, as a string, a > full URL containing a code value in its query string. > > By default though, url-http-oauth will prompt the user to copy-n-paste > URLs to and from the web browser. This is the most general default I > could think of; for example, this allows performing authorization in a > local web browser then pasting the result to an Emacs session running > three SSH hops away, where `browse-url' may not do the right thing. > > Users and package authors can design automatic user-agent interactions, > but those ways are so varied that I wanted to see how they would evolve. > For example, I would like to see someone write an > authorization-code-function for Sourcehut that would use EWW inline. > For other OAuth 2.0 providers whose authorization steps require > JavaScript, EWW would not work. > > I have published another, tiny package: > > https://git.sr.ht/~fitzsim/url-http-oauth-demo > > It demonstrates the use of url-http-oauth against the Emacs-friendliest > OAuth 2.0 implementation I've found: Sourcehut. Sourcehut's > implementation is entirely Free Software, and it does not require > JavaScript in the authorization steps. Its client registration process > does not have onerous terms of use. Any Sourcehut user should be able > to get url-http-oauth-demo working. Maybe this package makes sense in > GNU ELPA, or perhaps it could be part of url-http-oauth's documentation. > > I wrote these packages myself [1] and I have copyright assignment > paperwork on file. > > Thomas > > 1. Except url-http-oauth--netrc-delete, which borrows lots of code from > auth-source.el. > > --000000000000e4eea905fb29e3dc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I think packages such as this one are very welcome, and I= appreciate the UI-agnostic architecture you describe.
Url.el itself, last i looked, seemed a bit outdate= d and hard to work with. Are there other http client libraries for Emacs? C= ould they also take advantage of your new library?
<= br>
Jo=C3=A3o

On Sat, May 6, 2023, 06:07 Thomas= Fitzsimmons <fitzsim@fitzsim.org= > wrote:
Hi,

I would like to add one or two new packages to GNU ELPA.

The main one is url-http-oauth, which adds OAuth 2.0 support to the URL
library, via "url-auth" hooks, like url-http-basic, url-http-dige= st and
url-http-ntlm.=C2=A0 It provides auth-source integration for secrets, using=
the netrc backend.

=C2=A0 =C2=A0https://git.sr.ht/~fitzsim/url-http= -oauth

This package is unrelated to oauth2.el in GNU ELPA, which provides new
oauth2-url-retrieve and oauth2-url-retrieve-synchronously functions, and has plstore instead of auth-source integration.=C2=A0 For Excorporate, I needed something that would work with the built-in url-retrieve
functions and I couldn't see how to do that with oauth2.el.=C2=A0 I hav= en't
tested, but I see no reason that the two packages would interfere with
one another.

For the next release of Excorporate I want to depend on url-http-oauth
to fix the longstanding bug#50113, "Excorporate: Communicating with domain that requires SSO?".=C2=A0 I have the changes ready; I am using= them
daily.

The OAuth 2.0 standard encodes the use of a user-agent (i.e., web
browser) for authorization steps which differ per OAuth 2.0 provider,
and are not defined by the specification.=C2=A0 I have provided support for=
package authors and users to write custom functions to automate these
web browser interactions in arbitrary ways:

=C2=A0 =C2=A0AUTHORIZATION-CODE-FUNCTION is an elisp function that takes an=
=C2=A0 =C2=A0authorization URL as a string argument, and returns, as a stri= ng, a
=C2=A0 =C2=A0full URL containing a code value in its query string.

By default though, url-http-oauth will prompt the user to copy-n-paste
URLs to and from the web browser.=C2=A0 This is the most general default I<= br> could think of; for example, this allows performing authorization in a
local web browser then pasting the result to an Emacs session running
three SSH hops away, where `browse-url' may not do the right thing.

Users and package authors can design automatic user-agent interactions,
but those ways are so varied that I wanted to see how they would evolve. For example, I would like to see someone write an
authorization-code-function for Sourcehut that would use EWW inline.
For other OAuth 2.0 providers whose authorization steps require
JavaScript, EWW would not work.

I have published another, tiny package:

=C2=A0 =C2=A0https://git.sr.ht/~fitzsim/url= -http-oauth-demo

It demonstrates the use of url-http-oauth against the Emacs-friendliest
OAuth 2.0 implementation I've found: Sourcehut.=C2=A0 Sourcehut's implementation is entirely Free Software, and it does not require
JavaScript in the authorization steps.=C2=A0 Its client registration proces= s
does not have onerous terms of use.=C2=A0 Any Sourcehut user should be able=
to get url-http-oauth-demo working.=C2=A0 Maybe this package makes sense in=
GNU ELPA, or perhaps it could be part of url-http-oauth's documentation= .

I wrote these packages myself [1] and I have copyright assignment
paperwork on file.

Thomas

1. Except url-http-oauth--netrc-delete, which borrows lots of code from
=C2=A0 =C2=A0auth-source.el.

--000000000000e4eea905fb29e3dc--