gardner / react-oauth2-pkce

React auth provider that works with AWS cognito PKCE🛡️🔒
49 stars 57 forks source link

Code change with Webpack5 #50

Open ishita-kothari opened 2 years ago

ishita-kothari commented 2 years ago

Hello Team,

The code with this repo was working as expected with webpack lower than 5 but when we updated the webpack version, it is throwing error with createPKCECodes() function.

Error: ncaught (in promise) TypeError: (0 , crypto__WEBPACK_IMPORTED_MODULE_1__.randomBytes) is not a function at createPKCECodes (pkce.ts:22:1) at AuthService.authorize (AuthService.ts:176:1) at _callee$ (authInterceptor.jsx:9:1) at tryCatch (runtime.js:63:1) at Generator.invoke [as _invoke] (runtime.js:294:1) at Generator.next (runtime.js:119:1) at asyncGeneratorStep (axiosHelper.js:20:1) at _next (axiosHelper.js:20:1) at axiosHelper.js:20:1 at new Promise ()

It would be really helpful if someone can suggest some solution.

christoph-bittmann commented 2 years ago

Problem is already reported here: https://github.com/gardner/react-oauth2-pkce/issues/33

pablojakub commented 1 year ago

Problem is already reported here: #33

Yes, I added these to webpack config file and installed stream-browserify and crypto-browserify and still have problems in this method. This time: image