Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

Next steps for debugging redirect uri mismatch?

$
0
0

I'm currently trying to use the Youtube Data API to gather transcripts from videos posted on my site. This requires me to implement OAuth2, which I have done up to the point of exchanging the access code for the access token. When I make a request to Google to get the token, I'm getting a redirect_uri_mismatch error.

I have tried copying and pasting the redirect uri from the console into my code multiple times and double checking to make sure it matches exactly, but it still says the redirect uri doesn't match those that have been registered already. So, I thought it might have mistyped something around the uri, or that the puncutation might need to be embedded, so I tried performing the request in Postman, where those factors would be accounted for, again, copying and pasting from the console, and still no luck. From there, I thought it would either be the browser I was using or that it would just take time for the uri to update. I was getting the same error after clearing my browser cache, and also on Safari, and it's been over a day now since I changed the redirect_uri in the console.

Do you have any idea what the issue might be or where I might go from here, in terms of debugging?Here is the redirect uri exactly as it appears in the Google Cloud console:https://dotxav.ownsocial.io/wp-json/youtube/youtube-oauth2-token

Here is a segment of my code

$ch = curl_init();$client_secret = $GLOBALS\['client_secret'\];$client_id = $GLOBALS\['client_id'\];$redirect_uri = "https://dotxav.ownsocial.io/wp-json/youtube/youtube-oauth2-token";$url = "https://www.googleapis.com/oauth2/v4/token";curl_setopt($ch,CURLOPT_URL,$url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('grant_type' =\> 'authorization_code','code' =\> $code,'client_id' =\> $client_id,'client_secret' =\> $client_secret,'redirect_uri' =\> $redirect_uri)));$result = curl_exec($ch);curl_close($ch);

Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>