ryan-sandy / redux-oidc

A package for managing OpenID Connect authentication in ReactJS / Redux apps
MIT License
0 stars 0 forks source link

redux-oidc-2/index.d.ts (module not found) #1

Open jdavis-software opened 1 year ago

jdavis-software commented 1 year ago

@ryan-sandy running into a import issue, other than that looking at the code it looks good!

node_modules/redux-oidc-2/index.d.ts' is not a module.

Here is the import code

import { CallbackComponent } from "redux-oidc-2";

Am I missing something with the configuration of it? I am using CRA just FYI

Here are the packages as well:

    "oidc-client": "^1.11.5",
    "oidc-client-ts": "^2.2.4",
    "redux-oidc-2": "^1.0.0",
ryan-sandy commented 1 year ago

I just tested this with a fresh CRA and I'm not duplicating the error. I would try restarting the development server. If that doesn't work, try removing the library and reinstalling.

jdavis-software commented 1 year ago

@ryan-sandy yeah I tried both of those last Friday... and again this morning... it has to do with the types in the tsconfig

    "types": [
      "jest",
      "node",
      "cypress",
      "redux-oidc-2"
    ],

but that isn't resolving it, take a look at this stackoverflow , I think we need to add a npm i --save-dev @types/redux-oidc-2 or something because typescript isn't picking it up as a module. Any thoughts?

jdavis-software commented 1 year ago

@ryan-sandy actually looking at the declaration model index.d.ts for your package I think the name is redux-oidc-hooks not redux-oidc-2 and is causing it to error

declare module "redux-oidc-hooks" 
ryan-sandy commented 1 year ago

@jdavis-software I just pushed a new version that should have the correct export. Sorry about that. I missed it when I cloned the repo the first time. If it fixes this issue, let me know and I'll close the issue.

jdavis-software commented 1 year ago

@ryan-sandy perfect ty that fixed it but getting this error on the children of the <CallbackComponent>

image

ryan-sandy commented 1 year ago

@jdavis-software Try v1.1.1 now. I added the props to the export in index.ts.

M1019171 commented 1 year ago

@ryan-sandy i get the below error now

Only the Authorization Code flow (with PKCE) is supported Call Stack  OidcClient.createSigninRequest   bundle.js:50800:13  UserManager._signinStart   bundle.js:51940:48  UserManager.signinRedirect   bundle.js:51707:16


my response_type: "token id_token", in usermamanger

jdavis-software commented 1 year ago

@ryan-sandy perfect looks like its working now! @M1019171 make sure your run this before.

npm remove redux-oidc-2

then re-install

npm i redux-oidc-2@latest
ryan-sandy commented 1 year ago

@M1019171 You will also need to install the new userManager

npm remove oidc-client
npm install --save oidc-client-ts