Keep getting Error: redirect_uri_mismatch using youtube api v3

前端 未结 5 1185
孤街浪徒
孤街浪徒 2020-12-19 04:35

Hi I hope someone can help me out here.

I have a Web Application (asp.net) on my local machine, I am trying to upload video to YouTube using this sample https://deve

5条回答
  •  时光说笑
    2020-12-19 04:41

    There is a really easy way to get round this and I kicked myself when it dawned on me.

    I am using "Web Application" credentials - you'll want the credentials manager open btw.

    Run the DotNet sample app and let the browser open (I get the "Select An Account" page) - then look in the URL for the redirect URI that's been automatically generated by Google's code something like:

    redirect_uri%3Dhttp://localhost:62041/authorize/
    

    Then just go to the credentials manager and add this URL to the allowed list and save. Now select your google account and see what happens - it takes a few minutes for the API to update - if you get the redirect error page just hit back and select you account again - eventually it works and returns back to visual studio.

    Once the account has been authorised once it sticks (clear the bin directory to unstick it) but this means you can now put a break point in the code and look at the credentials variable to get the refresh token everyone is so desperately trying to get so that you can persist account connections.

提交回复
热议问题