oidc-client-ts icon indicating copy to clipboard operation
oidc-client-ts copied to clipboard

Metadata error after update from 2.0.4 to 2.0.5

Open Ic3xX opened this issue 3 years ago • 8 comments

Hello,

since the last update from 2.0.4 to 2.0.5 i'm getting the following error in my react web application after calling signInRedirectCallback(). Reverting back to 2.0.4 seems to work fine.

Any idea's why it isn't working anymore?

oidc-client-ts.js:105 [MetadataService] _getMetadataProperty('userinfo_endpoint'): Error: Metadata does not contain property userinfo_endpoint
    at MetadataService._getMetadataProperty (oidc-client-ts.js:853:1)
    at async UserInfoService.getClaims (oidc-client-ts.js:1065:1)
    at async ResponseValidator._processClaims (oidc-client-ts.js:1370:1)
    at async ResponseValidator.validateSigninResponse (oidc-client-ts.js:1273:1)
    at async OidcClient.processSigninResponse (oidc-client-ts.js:1899:1)
    at async UserManager._signinEnd (oidc-client-ts.js:3160:1)
    at async UserManager.signinRedirectCallback (oidc-client-ts.js:2889:1)

Ic3xX avatar Jun 28 '22 13:06 Ic3xX

The MetadataService did not change between 2.0.4 and 2.0.5, must be something else. Here are the differences: https://github.com/authts/oidc-client-ts/compare/v2.0.4...v2.0.5

Can you enable logging of the working and non working to see where the different is? Does it take another code path?

pamapa avatar Jun 28 '22 13:06 pamapa

I'm using the old version 2.0.4 and since this morning Im unable to build my Vue (with TypeScript) project anymore, because the type file causes errors. (oidc-client-ts/dist/types/oidc-client-ts.d.ts(9,47))

frontend/src/main/vue/node_modules/oidc-client-ts/dist/types/oidc-client-ts.d.ts(9,47)
9:47 ',' expected.
     7 | declare abstract class AbstractChildWindow implements IWindow {
     8 |     protected abstract readonly _logger: Logger;
  >  9 |     protected readonly _abort: Event_2<[reason: Error]>;
       |                                               ^
    10 |     protected readonly _disposeHandlers: Set<() => void>;
    11 |     protected _window: WindowProxy | null;
    12 |     navigate(params: NavigateParams): Promise<NavigateResponse>;

JulianBichl avatar Jun 28 '22 14:06 JulianBichl

The type file has not changed much. Specifically AbstractChildWindow did not change at all, there are some addition else where, which do not explain why it should not work. Diff: diff_oidc-client-ts.d.ts.patch.zip

In the package.json "types": "./dist/types/oidc-client-ts.d.ts", was added to "exports" section, that might affect you.

Which version of TypeScript are you using? I am using [email protected] together with [email protected] without problems.

pamapa avatar Jun 29 '22 07:06 pamapa

Thank you for your answer. I inspected the last commits and came to the result, that only in 2.0.5 the "types" was added to the export-section. But i'm using 2.0.4, and since yesterday i'm unable to use the oidc-client because of compliation error. I'm using version 3.9.3 :) Thank you for your help :) Edit: Might it be that the dependecy "Typedoc" ist affected by some bug? Edit: Is the older version 2.0.4 also affected by the "export"-section in the package.json?

JulianBichl avatar Jun 29 '22 07:06 JulianBichl

typedoc is only a dev dependency, so no problem.

Ideas to check:

  • Sometimes node_module is damaged or some frameworks like react-script add cache data, which might get inaccurate. Remove your node_module and reinstall everything from scratch.
  • Upgrade TypeScript to 4.6.4

The older 2.0.4 does not have the "types": "./dist/types/oidc-client-ts.d.ts"

pamapa avatar Jun 29 '22 10:06 pamapa

@Ic3xX Maybe you changed the settings.loadUserInfo to trigger this behavior. The error you get seems to be that your oidc server does not return metadata for userinfo_endpoint. You can verify this be enabling logging to debug. Its also possible to seed that metadata information, see settings.metadataSeed.

In any case you will need to provide more information.

pamapa avatar Jul 04 '22 06:07 pamapa

Same error over here, when we rollback to 2.0.4, everything is fine.

tomatualus avatar Jul 04 '22 13:07 tomatualus

@tomatualus type error or meta fetch error?

pamapa avatar Jul 05 '22 07:07 pamapa

For me updating to 2.0.6 is working fine but also updating to 2.0.5 is now working. The code hasn't changed so far but maybe something has changed in our meta endpoint (azure).

Ic3xX avatar Sep 26 '22 11:09 Ic3xX

Nice to hear it works again for you

pamapa avatar Sep 26 '22 13:09 pamapa