# Forest Admin "Please verify that you amin is set up correctly"

**URL:** <https://community.forestadmin.com/t/forest-admin-please-verify-that-you-amin-is-set-up-correctly/2178>\
**Category:** Help me!\
**Created:** [March 26, 2021, 10:47am UTC](https://community.forestadmin.com/t/forest-admin-please-verify-that-you-amin-is-set-up-correctly/2178 "2021-03-26T10:47:03Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![berkos](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/berkos/32/1784_2.png) [@berkos](https://community.forestadmin.com/u/berkos)\
**Post date:** [March 26, 2021, 10:47am UTC](https://community.forestadmin.com/t/forest-admin-please-verify-that-you-amin-is-set-up-correctly/2178/1 "2021-03-26T10:47:03Z")

</div>

## Expected behavior

When using the correct FOREST\_ENV\_SECRET I am expecting to work.

Please describe here the behavior you are expecting.

## Actual behavior

![Screenshot 2021-03-26 at 10.41.01](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/0/0b26ffc3e51411e1d5abf206f3058c2cd456b4bd.png)

On Browser console BE server raises a 500 when trying to access.

/forest/authentication/callback?error=UnauthorizedToAccessClientError&error\_description=You are not allowed to access to this client&state={“renderingId”=\>85890}

Please include any relevant log snippets, if necessary.

I’ve used the FOREST\_ENV\_SECRET  
Generated a random auth\_secret and used it.  
Set the correct application\_url  
and used

```javascript
curl -H "Content-Type: application/json" -H "Authorization: Bearer FOREST_ENV_SECRET" -X POST -d '{"token_endpoint_auth_method": "none", "redirect_uris": ["APPLICATION_URL/forest/authentication/callback"]}' https://api.forestadmin.com/oidc/reg

```

To generate a token

Please provide any relevant information about your setup.

- Package Version:6.1.1
- Rails 6.1.3
- Database Dialect:Postgres
- Database Version: 12

---

<div class="post-metadata">

**Author:** ![GuillaumeGautreau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/guillaumegautreau/32/557_2.png) [@GuillaumeGautreau](https://community.forestadmin.com/u/GuillaumeGautreau)\
**Post date:** [March 26, 2021, 10:51am UTC](https://community.forestadmin.com/t/forest-admin-please-verify-that-you-amin-is-set-up-correctly/2178/2 "2021-03-26T10:51:11Z")

</div>

Hello @berkos,

Just to be sure, did you use this request by replacing `FOREST_ENV_SECRET` inside the header `Authorization: Bearer FOREST_ENV_SECRET` by its actual value?

Can you send me by DM the last characters of the env secret you used, along with your project and environment names?

---

<div class="post-metadata">

**Author:** ![GuillaumeGautreau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/guillaumegautreau/32/557_2.png) [@GuillaumeGautreau](https://community.forestadmin.com/u/GuillaumeGautreau)\
**Post date:** [March 26, 2021, 10:55am UTC](https://community.forestadmin.com/t/forest-admin-please-verify-that-you-amin-is-set-up-correctly/2178/3 "2021-03-26T10:55:14Z")

</div>

Also, can you share with me in DMs the client id that you generated?

---

<div class="post-metadata">

**Author:** ![GuillaumeGautreau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/guillaumegautreau/32/557_2.png) [@GuillaumeGautreau](https://community.forestadmin.com/u/GuillaumeGautreau)\
**Post date:** [March 26, 2021, 12:35pm UTC](https://community.forestadmin.com/t/forest-admin-please-verify-that-you-amin-is-set-up-correctly/2178/4 "2021-03-26T12:35:14Z")

</div>

Ok, so to sum up after several private messages:

- Your generated client\_id seems good
- After checking the request sent by the browser to `https://api.forestadmin.com/oidc/auth` it appears that the provided client\_id at this stage is not correct.

So there is probably a configuration problem on your agent. You have to provide this new client id value to your application, as stated [in the docs](https://docs.forestadmin.com/documentation/how-tos/maintain/upgrade-notes-rails/upgrade-to-v6#setup-a-static-clientid).

---

<div class="post-metadata">

**Author:** ![berkos](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/berkos/32/1784_2.png) [@berkos](https://community.forestadmin.com/u/berkos)\
**Post date:** [March 26, 2021, 12:36pm UTC](https://community.forestadmin.com/t/forest-admin-please-verify-that-you-amin-is-set-up-correctly/2178/5 "2021-03-26T12:36:28Z")

</div>

Yes, this has happened. We identified that the server has the latest client\_id. Forest App (Browser) seems to be sending an old value. Is there a chance you are caching it on your side?

---

<div class="post-metadata">

**Author:** ![GuillaumeGautreau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/guillaumegautreau/32/557_2.png) [@GuillaumeGautreau](https://community.forestadmin.com/u/GuillaumeGautreau)\
**Post date:** [March 26, 2021, 12:40pm UTC](https://community.forestadmin.com/t/forest-admin-please-verify-that-you-amin-is-set-up-correctly/2178/6 "2021-03-26T12:40:36Z")

</div>

In fact, this client id sent by the browser is the one that your application provides to the browser. The authentication is done in multiple steps:

1. The browser contacts `youserver/forest/authentication`
2. Your server responds with a url to contact on the forest admin api: `http://api.forestadmin.com/oidc/auth?client_id=XXX&[OTHER-PARAMS]`
3. The browser contacts the Forest Admin server on this URL
4. The Forest Admin server authenticates the user that makes this call and returns an url on your server `yourserver/forest/authentication/callback` with a special code to finish the authentication process
5. The browser contacts your server at the provided URL
6. Your server checks the code and then creates a JWT that will authenticate the user on your server

You can see an incorrect clientId at step 2 because your server sends it to the browser. So I’m pretty sure that the configuration of your server is incorrect for this environment.

---

<div class="post-metadata">

**Author:** ![berkos](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/berkos/32/1784_2.png) [@berkos](https://community.forestadmin.com/u/berkos)\
**Post date:** [March 26, 2021, 12:45pm UTC](https://community.forestadmin.com/t/forest-admin-please-verify-that-you-amin-is-set-up-correctly/2178/7 "2021-03-26T12:45:35Z")

</div>

Thanks very much for explaining the detailed communication between Forest and Server. That will help for future debugging.

---

<div class="post-metadata">

**Author:** ![berkos](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/berkos/32/1784_2.png) [@berkos](https://community.forestadmin.com/u/berkos)\
**Post date:** [March 26, 2021, 2:49pm UTC](https://community.forestadmin.com/t/forest-admin-please-verify-that-you-amin-is-set-up-correctly/2178/8 "2021-03-26T14:49:55Z")

</div>

Hi @GuillaumeGautreau .  
I went all they way creating a new client\_id. I can verify in a rails console of that environment I am getting  
The new client\_id which I just generated by checking ForestLiana.forest\_client\_id . However the server from the Forest liana gem keeps sending an other value which is nowhere in an ENV variable or credentials.

I had a look on the source and **looks like there is some caching on your side using Rails.cache**

> <https://github.com/ForestAdmin/forest-rails/blob/3fb83d17e2cfa8aa6148f90eba1f62748e938135/app/services/forest_liana/oidc_client_manager.rb#L25>

Apart from that I can see that my Rails.cache.read(callback\_url) is present for that given url which means you are returning to me an old (deleted client) that does not exist anymore.

Only if that (Rails.cache.read(callback\_url) ) does not return a value you will only then try to generate this again using my ForestLiana.forest\_client\_id, here [forest-rails/oidc\_client\_manager.rb at 3fb83d17e2cfa8aa6148f90eba1f62748e938135 · ForestAdmin/forest-rails · GitHub](https://github.com/ForestAdmin/forest-rails/blob/3fb83d17e2cfa8aa6148f90eba1f62748e938135/app/services/forest_liana/oidc_client_manager.rb#L18)

Am I following this correctly?

Thanks

---

<div class="post-metadata">

**Author:** ![GuillaumeGautreau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/guillaumegautreau/32/557_2.png) [@GuillaumeGautreau](https://community.forestadmin.com/u/GuillaumeGautreau)\
**Post date:** [March 26, 2021, 2:56pm UTC](https://community.forestadmin.com/t/forest-admin-please-verify-that-you-amin-is-set-up-correctly/2178/9 "2021-03-26T14:56:41Z")

</div>

Hi @berkos,

You are totally right, the client id is currently first retrieved from the cache, and only if it has not been found the application reads from the environment variable.

We will work on a fix to avoid this kind of mismatch between the client id and the env variable if provided.

In the meantime, is it possible for you to clear this cache entry? It will probably fix your problem.

---

<div class="post-metadata">

**Author:** ![berkos](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/berkos/32/1784_2.png) [@berkos](https://community.forestadmin.com/u/berkos)\
**Post date:** [March 26, 2021, 3:04pm UTC](https://community.forestadmin.com/t/forest-admin-please-verify-that-you-amin-is-set-up-correctly/2178/10 "2021-03-26T15:04:30Z")

</div>

Yes I did that and fixed the issue. Going forward, I think it would nice your cache\_key to be a combination of the callback\_url and the client\_id.

Thanks

---

<div class="post-metadata">

**Author:** ![GuillaumeGautreau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/guillaumegautreau/32/557_2.png) [@GuillaumeGautreau](https://community.forestadmin.com/u/GuillaumeGautreau)\
**Post date:** [March 26, 2021, 3:06pm UTC](https://community.forestadmin.com/t/forest-admin-please-verify-that-you-amin-is-set-up-correctly/2178/11 "2021-03-26T15:06:54Z")

</div>

You are totally right, we will work on a fix that will probably work this way.

---

<div class="post-metadata">

**Author:** ![GuillaumeGautreau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/guillaumegautreau/32/557_2.png) [@GuillaumeGautreau](https://community.forestadmin.com/u/GuillaumeGautreau)\
**Post date:** [April 19, 2021, 2:12pm UTC](https://community.forestadmin.com/t/forest-admin-please-verify-that-you-amin-is-set-up-correctly/2178/12 "2021-04-19T14:12:06Z")

</div>

Just for information, `forest-rails` version `6.3.1` fixed this issue by adding bot the callback url and the environment secret to the cache key.
