Google API : is there a more 'flexible' way to specify redirect URIs?

2.5k views Asked by At

I am using the Google API to allow users to upload videos to their YouTube channel using my web app.

While working on the app and testing it on my local machine, I have been using redirect URIs like this one :

https://localhost:5001/Youtube?handler=authorize.

The thing is, when the app gets deployed, the redirect URIs should not, of course, contain localhost:5001 but another host name. Without changing the URIs in the Google Console, I get the

"redirect_uri_mistmatch" error.

Is there any way I can add a redirect URI to the Google Console that would make my app work in both situations?

Thanks a lot for your help!

1

There are 1 answers

3
Linda Lawton - DaImTo On BEST ANSWER

Redirect uris need to match exactly the location in your app that is capable of processing the authorization.

If your app is being hosted on a web server then you will need to add this redirect uri in google developer console as a valid redirect uri. For security reasons you cant run localhost in production. You will need to supply the redirect uri of your host when you deploy it for it to work.

There is no way to do this without changing it in developer console it must be configured as part of your app. How to fix redirect uri miss match error