# Authentication Error

**URL:** <https://community.forestadmin.com/t/authentication-error/3172>\
**Category:** Help me!\
**Tags:** setup\
**Created:** [August 30, 2021, 7:44am UTC](https://community.forestadmin.com/t/authentication-error/3172 "2021-08-30T07:44:32Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![Anupam\_Rana](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/anupam_rana/32/2523_2.png) [@Anupam\_Rana](https://community.forestadmin.com/u/Anupam_Rana)\
**Post date:** [September 1, 2021, 11:43am UTC](https://community.forestadmin.com/t/authentication-error/3172/12 "2021-09-01T11:43:29Z")

</div>

Thanks, I manage to make it work, I have changed few things in terms of initializing forest admin.

INSTEAD OF THIS

```javascript
app.use(await forest.init({
envSecret: process.env.FOREST_ENV_SECRET,
authSecret: process.env.FOREST_AUTH_SECRET,
objectMapping: models,
connections: { default: connection },
}));

```

I DID THIS

```javascript
forest.init({
    envSecret: process.env.FOREST_ENV_SECRET,
    authSecret: process.env.FOREST_AUTH_SECRET,
    objectMapping:require('mongoose'),
    connections: { default: mongooseConnection },
   }).then((FAMiddleware) => {
    app.use(FAMiddleware);
   });

```

```javascript

```

INSTEAD OF THIS

```javascript
app.use('/forest/authentication',cors(corsConfig)); // it returns status 404`

```

I DID THIS

```javascript
app.post('/forest/authentication',cors(corsConfig)); // it returns status 200`

```

---

_[View the full topic](https://community.forestadmin.com/t/authentication-error/3172)._
