Skip to content

v2.4 Client Registration Issues #3927

@jaxoncreed

Description

@jaxoncreed

Search terms you've used

Impacted package

Which packages do you think might be impacted by the bug ?

  • solid-client-authn-browser
  • solid-client-authn-node
  • solid-client-authn-core
  • oidc-client-ext
  • Other (please specify): ...

Bug description

Version 2.4 seems to have created a bug in apps that don't have a client document. Upon redirect, in handleRedirect, the library will place "null" in the redirect_uris field. This request fails:

curl 'https://solidcommunity.net/.oidc/reg' -X POST -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:137.0) Gecko/20100101 Firefox/137.0' -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br, zstd' -H 'Referer: http://localhost:5173/' -H 'Content-Type: application/json' -H 'Origin: http://localhost:5173' -H 'Connection: keep-alive' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' -H 'Priority: u=4' --data-raw '{"application_type":"web","redirect_uris":[null],"subject_type":"public","token_endpoint_auth_method":"client_secret_basic","id_token_signed_response_alg":"ES256","grant_types":["authorization_code","refresh_token"]}'

It yields a 400 error with the following body:

{
   "name":"InvalidClientMetadata",
   "message":"invalid_redirect_uri",
   "statusCode":400,
   "errorCode":"H400",
   "details":{},
   "error":"invalid_redirect_uri",
   "error_description":"redirect_uris must only contain strings"
}

I checked with version 2.3.0 and this problem doesn't seem to exist.

To Reproduce

You can run a simple demo app, for example:

import { getDefaultSession, handleIncomingRedirect, login } from "@inrupt/solid-client-authn-browser";
import { useCallback, useEffect, useState } from "react";

export const Component = () => { 
  const [session, setSession] = useState(undefined);

  const loginLocal = useCallback(async () => {
    // Start the Login Process if not already logged in.
    if (!getDefaultSession().info.isLoggedIn) {
      await login({
        oidcIssuer: "https://solidcommunity.net",
        redirectUrl: new URL("/callback", window.location.href).toString(),
        clientName: "My application"
      });
    }
  },
  []);

  useEffect(() => {
    setSession(getDefaultSession());
    handleIncomingRedirect().then(() => {
      setSession(getDefaultSession());
    });
  }, []);
  

  return <div>
    <div>{String(session?.info?.isLoggedIn)}</div>
    <button onClick={() => loginLocal()}>Click</button>
  </div>;
}

Click the button the Log in.

You should be redirected to solidcommunity.net and login there.

Upon redirect, observe that POST https://solidcommunity.net/.oidc/reg fails.

Expected result

Login works

Actual result

Client registration fails

Environment

Please run

npx envinfo --system --npmPackages --binaries --npmGlobalPackages --browsers

in your project folder and paste the output here:

$ npx envinfo --system --npmPackages --binaries --npmGlobalPackages --browsers
System:
    OS: macOS 14.3
    CPU: (12) arm64 Apple M3 Pro
    Memory: 103.36 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.17.0 - ~/.nvm/versions/node/v20.17.0/bin/node
    npm: 11.2.0 - ~/.nvm/versions/node/v20.17.0/bin/npm
    pnpm: 10.5.2 - ~/.nvm/versions/node/v20.17.0/bin/pnpm
  Browsers:
    Chrome: 135.0.7049.96
    Safari: 17.3
  npmPackages:
    @eslint/js: ^9.22.0 => 9.24.0 
    @inrupt/solid-client-authn-browser: 2.3.0 => 2.3.0 
    @ldo/solid-react: ^1.0.0-alpha.4 => 1.0.0-alpha.4 
    @types/react: ^19.0.10 => 19.1.2 
    @types/react-dom: ^19.0.4 => 19.1.2 
    @vitejs/plugin-react: ^4.3.4 => 4.4.0 
    eslint: ^9.22.0 => 9.24.0 
    eslint-plugin-react-hooks: ^5.2.0 => 5.2.0 
    eslint-plugin-react-refresh: ^0.4.19 => 0.4.19 
    globals: ^16.0.0 => 16.0.0 
    react: ^19.0.0 => 19.1.0 
    react-dom: ^19.0.0 => 19.1.0 
    vite: ^6.3.1 => 6.3.2 
  npmGlobalPackages:
    artillery: 2.0.15
    corepack: 0.29.3
    jest: 27.5.1
    npm: 11.2.0
    pnpm: 10.5.2
    ts-node: 10.9.2
    typescript: 5.7.3

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions