# Unable to register the client

**URL:** <https://community.forestadmin.com/t/unable-to-register-the-client/2774>\
**Category:** Help me!\
**Created:** [June 24, 2021, 9:53am UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774 "2021-06-24T09:53:45Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_BRAMI1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/simon_brami1/32/2753_2.png) [@Simon\_BRAMI1](https://community.forestadmin.com/u/Simon_BRAMI1)\
**Post date:** [June 24, 2021, 9:53am UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774/1 "2021-06-24T09:53:45Z")

</div>

Hi,

I just created a new project and scaffolded my Db but when I “npm start” and try to see my dashboard, it is unable to authenticate me.

I have the following logs:

POST /forest/authentication 400 67 - 144.622 ms  
[forest] 🌳🌳🌳 Unable to register the client

```json
{
  "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": {
    "error": "expected 201 Created with body but no body was returned"
  }
}

```

I tried to set up a new AUTH token but it’s still the same.

Any idea?

Here are my packages versions:

```javascript
"dependencies": {
    "body-parser": "1.19.0",
    "chalk": "~1.1.3",
    "cookie-parser": "1.4.4",
    "cors": "2.8.5",
    "debug": "~4.0.1",
    "dotenv": "~6.1.0",
    "express": "~4.17.1",
    "express-jwt": "6.0.0",
    "forest-express-sequelize": "^7.0.0",
    "morgan": "1.9.1",
    "require-all": "^3.0.0",
    "sequelize": "~5.15.1",
    "pg": "~8.2.2"
  }

```

---

<div class="post-metadata">

**Author:** ![anon16419211](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anon16419211](https://community.forestadmin.com/u/anon16419211)\
**Post date:** [June 24, 2021, 10:12am UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774/2 "2021-06-24T10:12:05Z")

</div>

Hello & welcome on our community forum @Simon_BRAMI1,

Can you share with me the failed query from the chrome development console in the networks tab?

Also, what is the name of the associated project?

Kind regards,  
Louis

---

<div class="post-metadata">

**Author:** ![Simon\_BRAMI1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/simon_brami1/32/2753_2.png) [@Simon\_BRAMI1](https://community.forestadmin.com/u/Simon_BRAMI1)\
**Post date:** [June 24, 2021, 10:27am UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774/3 "2021-06-24T10:27:43Z")

</div>

[http://localhost:3310/forest/authentication](http://localhost:3310/forest/authentication)  
This request fails with 400 error.

Request Headers:

1. Accept:  
2./\*
2. Accept-Encoding:  
gzip, deflate, br
3. Accept-Language:  
fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7
4. Connection:  
keep-alive
5. Content-Length:  
23
6. Content-Type:  
application/json; charset=utf-8
7. Host:  
localhost:3310
8. Origin:  
[https://app.forestadmin.com](https://app.forestadmin.com)
9. sec-ch-ua:  
" Not;A Brand";v=“99”, “Google Chrome”;v=“91”, “Chromium”;v=“91”
10. sec-ch-ua-mobile:  
?0
11. Sec-Fetch-Dest:  
empty
12. Sec-Fetch-Mode:  
cors
13. Sec-Fetch-Site:  
cross-site
14. User-Agent:  
Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_15\_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36

The associated project name is “Imok”

---

<div class="post-metadata">

**Author:** ![anon16419211](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anon16419211](https://community.forestadmin.com/u/anon16419211)\
**Post date:** [June 24, 2021, 12:35pm UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774/4 "2021-06-24T12:35:06Z")

</div>

Thanks for your answer,

What is your APPLICATION\_URL defined in your .env file? And also what is the content of the response from the request that failed?

---

<div class="post-metadata">

**Author:** ![Simon\_BRAMI1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/simon_brami1/32/2753_2.png) [@Simon\_BRAMI1](https://community.forestadmin.com/u/Simon_BRAMI1)\
**Post date:** [June 24, 2021, 2:31pm UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774/6 "2021-06-24T14:31:56Z")

</div>

APPLICATION\_URL=http://localhost:3310

The response is the following:

```javascript
{"error":"expected 201 Created with body but no body was returned"}

```

Thanks!

---

<div class="post-metadata">

**Author:** ![anon16419211](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anon16419211](https://community.forestadmin.com/u/anon16419211)\
**Post date:** [June 24, 2021, 3:01pm UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774/7 "2021-06-24T15:01:12Z")

</div>

Thanks,

what are the last 5 digits of your ENV\_SECRET from your .env file? And also can you share with me the body of the request that failed? 🙂

---

<div class="post-metadata">

**Author:** ![Simon\_BRAMI1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/simon_brami1/32/2753_2.png) [@Simon\_BRAMI1](https://community.forestadmin.com/u/Simon_BRAMI1)\
**Post date:** [June 24, 2021, 3:04pm UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774/8 "2021-06-24T15:04:09Z")

</div>

The last 5 digits are: bce9f

The body of the request POST [http://localhost:3310/forest/authentication](http://localhost:3310/forest/authentication)

```json
{"renderingId":"94937"}

```

🙌

---

<div class="post-metadata">

**Author:** ![anon16419211](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anon16419211](https://community.forestadmin.com/u/anon16419211)\
**Post date:** [June 24, 2021, 3:31pm UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774/9 "2021-06-24T15:31:32Z")

</div>

Everything seems good on that side 🙂

Have you setup a FOREST\_CLIENT\_ID in your .env file ? If so could you try to remove it an launch the authentication flow again?

Let me know if it helps,

---

<div class="post-metadata">

**Author:** ![Simon\_BRAMI1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/simon_brami1/32/2753_2.png) [@Simon\_BRAMI1](https://community.forestadmin.com/u/Simon_BRAMI1)\
**Post date:** [June 24, 2021, 3:37pm UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774/10 "2021-06-24T15:37:53Z")

</div>

Nop I didn’t I’m just trying to run the project locally. 🙁

---

<div class="post-metadata">

**Author:** ![anon16419211](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anon16419211](https://community.forestadmin.com/u/anon16419211)\
**Post date:** [June 24, 2021, 3:54pm UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774/11 "2021-06-24T15:54:22Z")

</div>

Have you been able to connect once? Did you finalize all the onboarding steps so that you had access to your project? 🙂

---

<div class="post-metadata">

**Author:** ![Simon\_BRAMI1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/simon_brami1/32/2753_2.png) [@Simon\_BRAMI1](https://community.forestadmin.com/u/Simon_BRAMI1)\
**Post date:** [June 24, 2021, 4:00pm UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774/12 "2021-06-24T16:00:37Z")

</div>

I wasn’t able on this project, I have another project running on the v6 that works great and is running on production.  
Before creating this new project I updated the lumber-cli and just followed the onboarding which perfectly scaffolded my DB and setup the codebase. And then the issue comes with the authentication…

Could that issue come from a dependency? Have you ever seen this error before?

---

<div class="post-metadata">

**Author:** ![anon16419211](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anon16419211](https://community.forestadmin.com/u/anon16419211)\
**Post date:** [June 24, 2021, 4:15pm UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774/13 "2021-06-24T16:15:30Z")

</div>

I have never seen this before, however I can see that there is no authorization headers in the request sent from your backend which should explain the root of your issue.

Could you try to set the version of sequelize to **7.11.3**

And just to be sure that everything is ok, could you please share with me your _app.js_ file ?

---

<div class="post-metadata">

**Author:** ![Simon\_BRAMI1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/simon_brami1/32/2753_2.png) [@Simon\_BRAMI1](https://community.forestadmin.com/u/Simon_BRAMI1)\
**Post date:** [June 24, 2021, 4:19pm UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774/14 "2021-06-24T16:19:03Z")

</div>

Do you mean forest-express-sequelize? Last version of sequelize is 6.6.2

my app.js:

```javascript
const express = require('express');
const requireAll = require('require-all');
const path = require('path');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const cors = require('cors');
const jwt = require('express-jwt');
const morgan = require('morgan');
const {
  errorHandler,
  ensureAuthenticated,
  PUBLIC_ROUTES,
} = require('forest-express-sequelize');

const app = express();

let allowedOrigins = [/\.forestadmin\.com$/, /localhost:\d{4}$/];

if (process.env.CORS_ORIGINS) {
  allowedOrigins = allowedOrigins.concat(process.env.CORS_ORIGINS.split(','));
}

const corsConfig = {
  origin: allowedOrigins,
  maxAge: 86400, // NOTICE: 1 day
  credentials: true,
};

app.use(morgan('tiny'));
app.use('/forest/authentication', cors({
  ...corsConfig,
  // The null origin is sent by browsers for redirected AJAX calls
  // we need to support this in authentication routes because OIDC
  // redirects to the callback route
  origin: corsConfig.origin.concat('null')
}));
app.use(cors(corsConfig));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use(jwt({
  secret: process.env.FOREST_AUTH_SECRET,
  credentialsRequired: false,
  algorithms: ['HS256'],
}));

app.use('/forest', (request, response, next) => {
  if (PUBLIC_ROUTES.includes(request.url)) {
    return next();
  }
  return ensureAuthenticated(request, response, next);
});

requireAll({
  dirname: path.join(__dirname, 'routes'),
  recursive: true,
  resolve: (Module) => app.use('/forest', Module),
});

requireAll({
  dirname: path.join(__dirname, 'middlewares'),
  recursive: true,
  resolve: (Module) => Module(app),
});

app.use(errorHandler());

module.exports = app;

```

---

<div class="post-metadata">

**Author:** ![Simon\_BRAMI1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/simon_brami1/32/2753_2.png) [@Simon\_BRAMI1](https://community.forestadmin.com/u/Simon_BRAMI1)\
**Post date:** [June 24, 2021, 8:31pm UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774/15 "2021-06-24T20:31:42Z")

</div>

Apparently, it works when I run my backend inside the docker container. This is not very convenient for me and I don’t understand what could cause this error outside of the container… Any idea?

It seems like the error message comes from openid-clien package.

I tried to clean npm cache and to set forest-express-sequelize to 7.11.3 but it has no effect.

I also recreated a test project but I keep getting the very same error.

---

<div class="post-metadata">

**Author:** ![anon16419211](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anon16419211](https://community.forestadmin.com/u/anon16419211)\
**Post date:** [June 25, 2021, 8:03am UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774/16 "2021-06-25T08:03:14Z")

</div>

All right, thanks for the update. Looking at your _app.js_ file, everything looks right.

Looking at your project I think there is one error at the launch of your server that could be the culprit of such a situation. Can you tell me if there is any error logs on your server launch?

---

<div class="post-metadata">

**Author:** ![Simon\_BRAMI1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/simon_brami1/32/2753_2.png) [@Simon\_BRAMI1](https://community.forestadmin.com/u/Simon_BRAMI1)\
**Post date:** [June 25, 2021, 8:45am UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774/17 "2021-06-25T08:45:19Z")

</div>

There is no error at launch, it’s just telling me that my server is running on port 3310, and the URL of my projects… The only error I have is the one I told you about when I try to access the dashboard and log in.

Do you have any snippets that could help me get more logs info?

By the way, my Node version is 14.1.0 and I know the docker container run a 10.X version.

---

<div class="post-metadata">

**Author:** ![Simon\_BRAMI1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/simon_brami1/32/2753_2.png) [@Simon\_BRAMI1](https://community.forestadmin.com/u/Simon_BRAMI1)\
**Post date:** [June 25, 2021, 9:22am UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774/18 "2021-06-25T09:22:13Z")

</div>

Update: I tried to use the same Node version as the docker container: 10.24.1 and now it works 😄

Could you tell me a recent stable version of Node that works with FA?

SOLUTION: Run away from Node 14.1.0

---

<div class="post-metadata">

**Author:** ![anon16419211](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anon16419211](https://community.forestadmin.com/u/anon16419211)\
**Post date:** [June 25, 2021, 1:21pm UTC](https://community.forestadmin.com/t/unable-to-register-the-client/2774/19 "2021-06-25T13:21:39Z")

</div>

Well done! 👏🏻

I personally use Node 14 for my projects and I have no particular problems with the launches. Maybe there was an incompatibility with the docker container set up. 😕
