400 Error: redirect_uri_mismatch for yotube video

2019-09-18 16:33发布

I am implementing functionality for uploading video's to a YouTube channel from here.

I set up my Google Developer console environment exactly like suggested.

enter image description here

I also use the same client Id and client secret that it gave me. When I run the script it returns with an error.

  1. That’s an error. Error: redirect_uri_mismatch Application: Localhost You can email the developer of this application at: XXXXX@gmail.com The redirect URI in the request: http://localhost/youtube/index.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://localhost/youtube/index.php
pageId=none
approval_prompt=auto
state=2067416475
client_id=xxxxxx68kc7csrag9as2o3lv70k0spa6hfb1ofs4.apps.googleusercontent

I don't understand the problem.

1条回答
别忘想泡老子
2楼-- · 2019-09-18 17:01

Redirect URI in the Google developers console states

One URI per line. Needs to have a protocol, no URL fragments, and no relative paths. Can't be a public IP Address.

You have set yours to

http://localhost/youtube

you should set it to

http://localhost/youtube/index.php

Redirect URI must be set to the path to the exact file which will handle the authentication.

Note: Also you will now want to delete that one because you need to keep your client id and client secret private you just shared it with everyone.

查看更多
登录 后发表回答