Reputation: 21
I'd like to integrate the Youtube API on my application. So I create a Youtube API. Then referring to this helpful link, I create the Client Id and Client secret of the file client_secrets.json bellow:
{
"installed": {
"client_id": "***",
"client_secret": "***"
}
}
I'm trying to upload a video to Youtube. so after running the required code shared on Github: UploadVideo.java, I encounter this ERROR.
And after open this url, I got:
- That’s an error.
Error: redirect_uri_mismatch
Have you please any idea about solving this problem, any proposition is appreciated. Thanks a lot.
Upvotes: 0
Views: 4718
Reputation: 1985
The Google API Client Library OAuth2 docs states,
Keep your client secret private. If someone obtains your client secret, they could use it to consume your quota, incur charges against your Developers Console project, and request access to user data.
Here are the steps to get secrets.json for youtube api...
Step1. Go to console https://console.developers.google.com/iam-admin/
Step2. Select your Service Project.
Step3. Click on Service Accounts tab on left side.
Step4. In Service Accounts, at the end of the service accounts you will find an options button. click on it.
Step5. Click on Create Key.
Step6. It will show you a dialog to selecte keytype JSON or P12. Select JSON and click create.
Step7. Your Json will be automatically downloaded.
Step8. For Android and Java, in main directory, create new directory resources and paste your json file.
Step9. Read it this file where you want your users to authorize.
Upvotes: 3