Unable to register the client error after upgrade v7

Feature(s) impacted

after I try to upgrade my project to v7 I am getting this error.

Observed behavior

Unable to authenticate you

We can’t reach your server. Please check that your admin backend is correctly configured and running.

Expected behavior

Working as expected without any error.

Failure Logs

[forest] 🌳🌳🌳  Unable to register the client
{
  "configuration": {
    "authorization_endpoint": "https://api.forestadmin.com/oidc/auth",
    "device_authorization_endpoint": "https://api.forestadmin.com/oidc/device/auth",
    "claims_parameter_supported": false,
    "claims_supported": [
      "sub",
      "email",
      "sid",
      "auth_time",
      "iss"
    ],
    "code_challenge_methods_supported": [
      "S256"
    ],
    "end_session_endpoint": "https://api.forestadmin.com/oidc/session/end",
    "grant_types_supported": [
      "authorization_code",
      "urn:ietf:params:oauth:grant-type:device_code"
    ],
    "id_token_signing_alg_values_supported": [
      "HS256",
      "RS256"
    ],
    "issuer": "https://api.forestadmin.com",
    "jwks_uri": "https://api.forestadmin.com/oidc/jwks",
    "registration_endpoint": "https://api.forestadmin.com/oidc/reg",
    "response_modes_supported": [
      "query"
    ],
    "response_types_supported": [
      "code",
      "none"
    ],
    "scopes_supported": [
      "openid",
      "email",
      "profile"
    ],
    "subject_types_supported": [
      "public"
    ],
    "token_endpoint_auth_methods_supported": [
      "none"
    ],
    "token_endpoint_auth_signing_alg_values_supported": [],
    "token_endpoint": "https://api.forestadmin.com/oidc/token",
    "request_object_signing_alg_values_supported": [
      "HS256",
      "RS256"
    ],
    "request_parameter_supported": false,
    "request_uri_parameter_supported": true,
    "require_request_uri_registration": true,
    "claim_types_supported": [
      "normal"
    ]
  },
  "registration": {
    "redirect_uris": [
      "http://localhost:3310/forest/authentication/callback"
    ],
    "token_endpoint_auth_method": "none"
  },
  "error": {
    "name": "RequestError",
    "code": "ECONNREFUSED",
    "timings": {
      "start": 1669984577551,
      "socket": 1669984577551,
      "lookup": 1669984577552,
      "error": 1669984577552,
      "phases": {
        "wait": 0,
        "dns": 1,
        "total": 1
      }
    }
  }
}
[forest] 🌳🌳🌳  Unexpected error: connect ECONNREFUSED 127.0.0.1:443
{
  "name": "RequestError",
  "code": "ECONNREFUSED",
  "timings": {
    "start": 1669984577551,
    "socket": 1669984577551,
    "lookup": 1669984577552,
    "error": 1669984577552,
    "phases": {
      "wait": 0,
      "dns": 1,
      "total": 1
    }
  },

Context

  • Project name: Sesto
  • Team name: …
  • Tech name: MongoDB + Nodejs
  • Agent type & version: …
  • Recent changes made on your end if any: version upgrade v6 to v7

Hello @Blockchain_Game_dev,

Could you please fill in the required info at the end of the template, indicating your project’s name, technology, etc? It’ll help us helping you.

Also, can you please check if you have any of these packages in your dependencies:

It seems that these libraries (or at least old versions of them) are making strange things with http code, and it conflicts with our calls.

Hi, i am using @google/maps but can’t I use google maps and forest admin at the same time even for testing on my local ?

It seems that this library is deprecated in favor of @googlemaps/google-maps-services-js which does not have the issue.

Hi removed that library but now I am getting these in server seems like no problem but it is loading like in screenshot.
Screen Shot 2022-12-02 at 16.53.26

OPTIONS /forest/authentication 204 3.352 ms - 0
POST /forest/authentication 200 226.992 ms - 1020

also in network,

there is two authentication call one return 204 ( request method: options) other return 200 ( request method: origin)

Can you share a screenshot with the different calls happening during the authentication?

Do you have any call in error? Do you have any error in the console?

Also, did you follow all the steps described in the documentation to upgrade to V7?

I have no error in agent.

Agent logs :
OPTIONS /forest/authentication 204 0.388 ms - 0
POST /forest/authentication 200 2.052 ms - 1020

These are calls for authentication in network tabs.


I did all the steps except Running up multiple server instances because i am testing my project on my server.

Do you have any indication of a CORS error regarding the POST? It seems that it shows only provisional headers, which may indicate that there is a problem with CORS.

yes, I am using cors unblock extension, otherwise I couldn’t access.

Can you share the content of the CORS error?

Access to fetch at 'http://localhost:4040/forest' from origin 'https://app.forestadmin.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Ok, then there is a problem with the CORS configuration of your agent. Can you copy/paste the code related to CORS?

const whitelist = config.allowedOrgins.split(',');

const corsConfig ={
  credentials: true,
  allowedHeaders: ['Authorization', 'X-Requested-With', 'Content-Type'],
  origin: whitelist,
  maxAge: 86400, // NOTICE: 1 day
};

app.use('/forest/authentication', cors({
  ...corsConfig,
  origin: corsConfig.origin.concat('null')
}));
app.use(cors(corsConfig));

Can you please use the same config we can find in the docs?

let allowedOrigins = [/\.forestadmin\.com$/, /localhost:\d{4}$/];
if (process.env.CORS_ORIGINS) {
  allowedOrigins = allowedOrigins.concat(process.env.CORS_ORIGINS.split(','));
}
const corsConfig = {
  origin: allowedOrigins,
  allowedHeaders: ['Authorization', 'X-Requested-With', 'Content-Type'],
  maxAge: 86400, // NOTICE: 1 day
  credentials: true,
};

The same error is loading icon is spinning, just like cors blocked extension enabled.

Do you have a CORS error now, and is it the same?

I don’t have cors error, I only have authetication problem.

Then can you please share a screenshot of the list of calls that are made by the frontend while trying to authenticate?



It seems that there is still an error, as your POST request is not sent. But can you please make a screenshot of the list of all calls, not the details of these 3 calls please? I’d like to see how they are chained.

Please deactivate your extension to unblock CORS requests because we need to fix these cors issues.