Okta SSO stopped functioning after upgrading from v3.02 to v4.05

After upgrading Node-Red docker image from v3.0.2 to v4.0.5, okta sso login stopped working with an error: Uncaught TypeError: Cannot read properties of undefined (reading 'substring'). The settings.json file contains the following adminAuth section. Please help if you have any info on this issue.

 adminAuth: { 
      type:"strategy", 
      strategy: { 
          name: "okta", 
          label: 'Sign in with Okta', 
          icon:"fa-key", 
          strategy: require("passport-okta-oauth").Strategy, 
          options: { 
              audience: 'https://$COMPANY_NAME.okta.com', 
              clientID: '$CLIENT_ID', 
              clientSecret: '$CLIENT_SECRET', 
              scope: ["openid", "email", "profile", "offline_access"], 
              callbackURL: 'https://$NODE_RED_DOMAIN/auth/strategy/callback', 
              verify: function(accessToken, refresh_token, params, profile, done) { 
              const jwt = require("jsonwebtoken"); 
              var decodedToken = jwt.decode(params.id_token); 
              var decodedAccessToken = jwt.decode(params.access_token); 
              console.log(decodedToken); 
              console.log(decodedAccessToken); 
              profile.username = decodedToken.upn; 
              done(null, profile); 
              } 
          }, 
      }, 
      users: function (username){ 
      return Promise.resolve ({username: username, permissions: "*"}); 
    } 
  },

The Dockerfile file contains the following lines:

RUN npm install node-red-contrib-modbus jsonwebtoken
RUN npm install passport passport-okta-oauth passport-azure-ad-oauth2