Is there a way to manage multiple redirect URI for different environments in the Instagram Developer website?

StackOverflow https://stackoverflow.com/questions/22493374

  •  17-06-2023
  •  | 
  •  

Question

I am wondering if there is a way to manage multiple redirect URI in the Instagram Developer website, for example with different environments.

On the Instagram developer center I have set the redirect URI as this for the dev environment.

http://localhost:3000/oauth/callback 

But now I would like to push it to production, so I need to change this URI to the production one to get something like:

http://mywebsite/oauth/callback

but then I won't be able to get the correct redirection when I'm coding locally.

Was it helpful?

Solution

Best choice in my opinion would be to create two clients (apps) on Instagram:

  • one for production
  • one for dev

You will then have two sets of credentials.

For example with Rails switch from one config to the other depending on the current environment:

if Rails.env == "development" || Rails.env == "test"
  # load development instagram client config
else
  # load production instagram client config
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top