Re-aligning Authentication for OPDS with OAuth 2.1 #82
Replies: 5 comments 3 replies
-
Let's go further and illustrate how this could work, for example using Thorium as a client. While browsing in a catalog, Thorium receives a 401 with the following Authentication Document:
You'll notice a new addition in this response: Since Thorium relies on a webview to intercept the When calling the OAuth 2.1 Authorization Endpoint, the following parameters are sent to the Authorization Server: You'll notice that while
If we assume that the Authorization Server has properly registered the OPDS shared identifier, three different scenarios can happen based on this request:
For the first two scenarios, once the user has properly authenticated, Thorium will end up receiving a For the third scenario, an error response is returned by the Authorization Server. Since the Authentication Document states that webviews are disallowed, Thorium could either:
|
Beta Was this translation helpful? Give feedback.
-
With this discussion, I'm also proposing the creation of a new registry that would identify well-known Here are some additional thoughts:
|
Beta Was this translation helpful? Give feedback.
-
Our server will not allow arbitrary values for
I understand why this is necessary, but I'm not sure we can do this in practice as the definition of
I'm not sure this is a problem at the moment - is the |
Beta Was this translation helpful? Give feedback.
-
To prevent duplicating existing information across authentication documents, is there any chance that the OAuth methods supported by an OAuth Server could be communicated via their existing OIDC Discovery document? {
"type": "http://opds-spec.org/auth/oidc/",
"allowsWebview": false,
"links": [
{"rel": "openid-configuration", "href": "http://example.com/.well-known/openid-configuration", "type": "application/json"},
]
} The advantage of this for developers is that there exist many packages to set up OAuth automatically when pointed to an OIDC Discovery Document. |
Beta Was this translation helpful? Give feedback.
-
Since there's a lot to discuss for this re-alignment, I'll open separate discussions. Here are some of the topics that I've identified so far:
At this point, I don't think that dropping Basic Auth should be on the table. It's used by a large number of organizations and remains useful for simple use cases, such as self-hosted catalogs or private catalogs that do not require true user authentication. |
Beta Was this translation helpful? Give feedback.
-
I've spent quite a bit of time looking into the state of OAuth 2.1 and while it's still a draft (this has been the case since 2020), it feels fairly stable in terms of scope.
Looking at the list of changes between OAuth 2.0 and 2.1 it's very obvious that this revision impacts our work very deeply:
These are the two grants that we currently support and they're both being dropped from the specification. As a replacement, OAuth 2.1 recommends using the Authorization Code grant with PKCE:
Several stakeholders have already expressed their interest in using Authorization Code with PKCE which has additional benefits in addition to being more secure (the client receives a Refresh Token in addition to an Access Token, unlike the Implicit grant).
We need to add this grant type and recommend using it over Implicit Grant and Resource Owner Password Credentials grant.
Our usage of a shared client identifier and callback has always been a bit of a hack because by design, OAuth requires to register the client before any interaction. This doesn't fit with the open and decentralized nature of OPDS.
As we can see, the
opds://
URI scheme doesn't fit with the security best practices of OAuth 2.1 but in real-word usage it has also been difficult to use it reliably.On iOS/iPadOS/macOS, registering a URI scheme is quite unreliable, as the user has no control over which app will actually open the
opds://
URI scheme. Depending on the version of the OS that's used, it will either open the first or the last app that registered this scheme.We end up with OPDS clients that need to implement a webview to capture the
opds://
URI scheme, which is frowned upon at best and even blocked by some Authorization Providers such as Google.To work around this issue, we would need to move away from this shared
redirect_uri
, but I only see two options at our disposal:client_id
andredirect_uri
(multiple values), which is aligned with best practices for OAuth but kind of goes against the principles of OPDSredirect_uri
, which is explicitly forbidden by the OAuth 2.1 specification but feels more closely aligned with OPDSBoth options have a major impact on the OPDS ecosystem:
redirect_uri
since this goes against the specificationIt feels like we'll need to figure out a compromise somehow.
Specialized clients who only interact with a list of well-known Authorization Servers should register themselves to these servers and use their own
client_id
.Public catalogs which are meant to interact with arbitrary OPDS clients could:
redirect_uri
for our sharedclient_id
that are in-use by popular OPDS clients, in addition toopds://
redirect_uri
as long as they follow the recommendations expressed in the OPDS 2.1 specThis way, OPDS clients could attempt to use their own
redirect_uri
but fallback toopds://
if they get rejected.With this middle ground, we'll still need to maintain a list of well-known
redirect_uri
for the shared client identifier, but we'll minimize the risk of Authorization Servers that are not up-to-date by offering both a fallback (opds://
) and potential support for arbitraryredirect_uri
values.We could also restrict the use of other values for
redirect_uri
strictly to the Authorization Code grant, while the Implicit grant would continue to useopds://
.Beta Was this translation helpful? Give feedback.
All reactions