Conversation
`Session.fromAuthorizationRequestState` can now be used with a statically registered client. A NodeJS client that has been registered can authenticate to the OpenID Provider when going through the Authorization Code flow. Previously, only Solid-OIDC URL-based client identifiers were supported.
The client id fits naturally in the authorization request state, and the client secret does not, so it's better to add it as a separate arg rather than overloading the input type and require type gymnastics.
| "module": "preserve", | ||
| "strict": true, | ||
| "declaration": true, | ||
| "declarationMap": true, |
There was a problem hiding this comment.
This is not directly related to the changes in this PR, but it makes navigating the code easier (it was long overdue).
| webId?: string; | ||
| } | ||
|
|
||
| export type SessionManagerAuthorizationState = AuthorizationRequestState & { |
There was a problem hiding this comment.
Enforce the supported states in the type to prevent invalid state being representable.
|
|
||
| # Solid-OIDC Client identifier for the application. | ||
| CLIENT_ID="https://storage.inrupt.com/d70fd154-de71-4627-89f3-9f9515950f7a/client_ids/ca999ecd-7951-4982-b7eb-d4376985f978" | ||
| # For a statically registered client, set the CLIENT_ID and CLIENT_SECRET to the credentials issued by the Identity Provider |
There was a problem hiding this comment.
Should we have to set a CLIENT_TYPE? It would be a bit more explicit if we had to.
| } else if (hasSecret) { | ||
| state = { | ||
| ...authorizationRequestState, | ||
| keepAlive: false, | ||
| clientType: "static", | ||
| clientSecret, | ||
| }; |
There was a problem hiding this comment.
A follow on from: https://github.com/inrupt/solid-client-authn-js/pull/4388/changes#r3970848217 - it might be more extensible if we avoid this logic and have a proper type setting.
There was a problem hiding this comment.
That's a good point, we track this internally anyway. However, I'd prefer to do this change separately, so that it is applied consistently across all the relevant APIs (which goes beyond the scope of this PR): the client type should be set before the authorization request (so in the login function), and the same change should be applied to the browser package. I'll create the follow-up ticket.
Session.fromAuthorizationRequestStatecan now be used with a statically registered client. A NodeJS client that has been registered can authenticate to the OpenID Provider when going through the Authorization Code flow. Previously, only Solid-OIDC URL-based client identifiers were supported.New feature description
Checklist
index.ts, if applicable. N/A