2

I got the Client Id and API Key by registering my project with developer console. And While running authentication process i get an error like this 400. That’s an error. Error: redirect_uri_mismatch The redirect URI in the request: http://localhost:8080/ did not match a registered redirect URI.

I have not registered any redirect uri. Can anyone fix this or tell me how to set the redirect uri.I could not find any redirect url while registering.enter image description here

David
  • 906
  • 3
  • 11
  • 23

1 Answers1

6

The redirect URI is an object only used by web applications that are doing oAuth2 authentication; so, when you create a new client ID, choose "web application" as the ID type and there will be a text area where you enter all of the allowed redirect URIs (these web pages will be coded by you, and will need to perform the function of doing the oauth2 ticket verification).

If your app is not a web application, you choose "installed application" as the type and you'll get a key that can be used in an Android/iOS/desktop app. However, this key will NOT be useable, at all, in a web application.

If your web application doesn't need to write any data or upload any files, you can create a public API key that you just include as a parameter with your requests.

Service accounts (which you're showing in the image above) are not compatible with the YouTube API.

jlmcdonald
  • 13,408
  • 2
  • 54
  • 64
  • Thanks @jlmcdonald. Can you tell me what must i use for YouTube API. Web applications , Installed Applications or Any other. – David Apr 22 '15 at 17:32
  • Is your app running on the web, or on a device? – jlmcdonald Apr 22 '15 at 18:31
  • @jlmcdonald.On device. I have referred this https://github.com/sohnkh/YoutubeUploadAndroidSampleV3. But I am making some mistake. Can you please send any links for uploading a video to youtube. A samplecode will be a great help sir. I referred google developer site, but could not understand. All i want is to upload a video to youtube from my app. I tried with intents, but i am getting the Title and descriptions empty. Can you please help me with this sir. – David Apr 23 '15 at 00:32
  • So wait, if you need your app server to work for iOS and for web, is that not possible, or only with 2 different configs? Seems like you should be able to set it up for "installed apps" and web/redirect urls – TahoeWolverine Nov 09 '15 at 01:27
  • What should I enter as redirect_uri when cancelling In App Billing subscription like here: https://developers.google.com/android-publisher/api-ref/purchases/subscriptions/cancel#auth – Yar Oct 23 '17 at 17:07