1

I am using the code example in the below link to use the Youtube API to upload videos to Youtube.

https://developers.google.com/youtube/v3/code_samples/php#resumable_uploads

I get 400. That's an error Error: redirect_uri_mismatch everytime I try to authorise access.

I have rechecked a hundred time to ensure the Redirect URI in the developer console and redirect request URI match exactly. So I am pretty stumped on this error.

Error Details

The redirect URI in the request: http://www.example.com/classes/YouTubeVideoUpload.php did not match a registered redirect URI.

Request Details

scope=https://www.googleapis.com/auth/youtube
response_type=code
access_type=online
redirect_uri=http://www.example.com/classes/YouTubeVideoUpload.php
pageId=none
approval_prompt=auto
state=463513941
client_id=*************-gajjqgcjt767rfqapprgu5ctdi3qts27.apps.googleusercontent.com

Is there something else likely to cause it to think there is a mismatch?

user1711576
  • 412
  • 10
  • 25
  • Redirect_uri must match the redirect URI you put in developers console. It is in fact the name of the file that you would like the authentication returned to. Unless you have changed your code for posting or you personally own www.example.com don't think that's going to work. – Linda Lawton - DaImTo Sep 23 '14 at 11:23
  • The redirect URI's do match exactly. The redirect is the same as the original file it was submitted from. I edited the code for posting – user1711576 Sep 23 '14 at 11:25
  • http://www.example.com/classes/YouTubeVideoUpload.php <-- is that your website ? – Linda Lawton - DaImTo Sep 24 '14 at 06:40
  • No, as I said it was edited for posting – user1711576 Sep 24 '14 at 08:24

1 Answers1

1

The issue was being caused by the API key which had been set.

$client->setAPIKey($API_Key);

Once deleted script executed as expected

The Error: redirect_uri_mismatch was quite misleading for this error

user1711576
  • 412
  • 10
  • 25