Unable to authenticate [express - mongoose]

Expected behavior

I can proceed to forest admin panel.

Actual behavior

I’m getting error about authentication.

Failure Logs




My server is running on port 5000, however the authentication request from callback is on port 3310.

Context

Code:


Hello @AleksandraKaminska,

Can you share with us the name of your project and the environment you are working on?

Did you define the APPLICATION_URL environment variable to https://localhost:5000?

Hello Guillaume,
project name: Migit,
development environment.
Yes I did, I put all listed config vars to my .config.env file.

Thanks for the details.

Can you please share the response to the first request POST to /forest/authentication on your local server?

Thanks

{"authorizationUrl":"https://api.forestadmin.com/oidc/auth?client_id=eyJraWQiOiJ6d0VjbU5LVVpVTkdYUnlNRzZ2QUoyTTVfYzBoZGhfblBXS0hYWjhGUTFBIiwiYWxnIjoiUlMyNTYifQ.eyJyZWRpcmVjdF91cmlzIjpbImh0dHA6Ly9sb2NhbGhvc3Q6MzMxMC9mb3Jlc3QvYXV0aGVudGljYXRpb24vY2FsbGJhY2siXSwidG9rZW5fZW5kcG9pbnRfYXV0aF9tZXRob2QiOiJub25lIiwiYXBwbGljYXRpb25fdHlwZSI6IndlYiIsImdyYW50X3R5cGVzIjpbImF1dGhvcml6YXRpb25fY29kZSJdLCJyZXNwb25zZV90eXBlcyI6WyJjb2RlIl0sImVudmlyb25tZW50X2lkIjo4MDk4NSwiaXNzIjoiRk9SRVNUX0FVVEhFTlRJQ0FUSU9OX1NZU1RFTSIsImlhdCI6MTYzMTk2ODk0NX0.ELjsj5sIWv5DFCRWxuaYwa6ZtLDOT6PjHbA_5pWBGUZowt2SXd6wST3Qk7Qewotop5YZzGYJ9uGLEp7R2seSG_P4dooW7dBA_UJNrx4-t16MmQbBvNS-YAMSzxKxlEVJJzx7-v8xI-ru4VaGHL7YlFlbikSHVHhsLAM8l7FofaybOVFVWdFCabwmHlq60p6uNITH_VBopgRMZo1U_j3X_HAN-psMbXLDkjEXlhBRg5ipRiOEnncjtxKhUG7U1LA0zSjqkmD6mNRBvubnT-puO2xqyCEBt83TqLDUh0UaSGeE2Cfa4QQEL3b3kpjTu9Cel17JGhr16zCC0nDWB-ugRg&scope=openid%20email%20profile&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A3310%2Fforest%2Fauthentication%2Fcallback&state=%7B%22renderingId%22%3A100877%7D"}

I have set up both FOREST_ENV_SECRET and FOREST_AUTH_SECRET environment vars.

Hello,

It seems that the environment variable APPLICATION_URL is not correctly set to http://localhost:5000. As far as I can see the client id has been generated for http://localhost:3310 which means that your agent sent this value to the server.

The callbackUrl is directly coming from APPLICATION_URL, indicating that this environment variable is not correctly set.

Can you please share with us the content of your .env file, with obfuscated values for the FOREST_ENV_SECRET and FOREST_AUTH_SECRET ?

I have setup envs as I described above. Everything copied directly to my .env file from your setup guide. APPLICATION_URL has value http://localhost:5000. You can see attached the first screen with response 200 to http://localhost:5000/forest/authentication. Anyway I moving my app to postgres, so I can’t attach more screens. Fyi your setup guide for postgres works for me.
Thanks