Invalid redirect URI in Forest Admin

Feature(s) impacted

Trying to log in into Forest

Observed behavior

When I want to log in, I have this error message :

Expected behavior

I expect to log in into Forest

Failure Logs

In the console, I can see this error message :

  1. detail: “The redirect uri must be one of http://api..com/forest/authentication/callback. Received "https://api..com/forest/authentication/callback”"

Context

I check all my env variable, they are all set with “https”, I don’t know why Forest try to find an url with “http”.

I’m on Ruby 2.7, Rails 5, with Forest admin 7.4.5 and I’m working on production environement

Hi @Kirimari :wave: welcome to our community.
I’m sad to hear that :slightly_frowning_face: in order to try to help you correctly can you give us your project name please?

Hi. Thanks for your reply.
The Project name is StockApi.

Hello @Kirimari,

Usually this error is thrown when your APPLICATION_URL is not correctly configured or passed to the liana.

The redirect url is constructed by adding /forest/authentication to the APPLICATION_URL.

1/ Can you confirm that your application url is the right one ?
2/ I can see on this stack overflow thread that sometimes due to some gem, your environment variables are cached and not automatically reload, do you think it can be the culprit here?

Kind regards,
Louis

Hi @anon16419211 ,

I checked that my Application_URL is the correct one on my env variable, it’s “https://api.****.com”.
And I restart Puma and my environnement on aws, but still nothing.

Thanks for the follow up,

Can you open your dev tool in your browser and share with me the network call that is failing with his associated response ? :pray:

Here is the request :

Here is the response :

The question is why is he expecting an url beginning by “http” and where can I configure that ?

Can you please send me your clientId in PM ?

I’m 90% sure it comes from a rails cache memory issue. Please take a look at this thread. It looks like the application has the same issue as yours and it can probably help :slight_smile:

Kind regards,
Louis

@anon16419211 I checked on my ClientId and the one in the screenshot and the one in my env file are the same.

I tried to clear my cache using Rails.cache.clear but still the same issue

Okay, I just reset my clientId using this request:
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

with the “https” link for the APPLICATION_URL and it’s working now

Thank you @anon16419211 and @Arnaud_Moncel for your help :slight_smile:

2 Likes

Perfect !!! I hope it was clear enough, I wish you a good time on ForestAdmin :slight_smile:

1 Like