I'm going nuts with this error. As far as I can see I've followed the instructions correctly. My scopes are YOUTUBE_FORCE_SSL. In desperation I've tried to add all Google Plus Scopes without luck. Still get the same error, both in the device, emulator and Google Api Explorer. The video I try to comment on are public. I have a Google+ profile and are signed in with it when I try to make a comment.
This is the full error:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{
"code" : 403,
"errors" : [ {
"domain" : "youtube.commentThread",
"location" : "Authorization",
"locationType" : "header",
"message" : "The callers YouTube account is not connected to Google+.",
"reason" : "ineligibleAccount"
} ],
"message" : "The callers YouTube account is not connected to Google+."
}
This is my code:
try {
HashMap<String, String> parameters = new HashMap<>();
parameters.put("part", "snippet");
CommentThread commentThread = new CommentThread();
CommentThreadSnippet snippet = new CommentThreadSnippet();
Comment topLevelComment = new Comment();
CommentSnippet commentSnippet = new CommentSnippet();
commentSnippet.set("textOriginal", textComment);
commentSnippet.set("channelId", channelId);
commentSnippet.set("videoId", ytId);
topLevelComment.setSnippet(commentSnippet);
snippet.setTopLevelComment(topLevelComment);
commentThread.setSnippet(snippet);
YouTube.CommentThreads.Insert commentThreadsInsertRequest = mService.commentThreads().insert(parameters.get("part"), commentThread);
CommentThread response = commentThreadsInsertRequest.execute();
Log.i("COMMENT:", response.toString());
}
Adding screenshot from Api Explorer:
Can you get CommentThreads: insert to work with the API Explorer? If so, how?
I have seen the answers to a similar question here and they don't solve this problem.
Any help is appreciated.
Edit 1
After further testing. Everything works fine with an old account I have. I've tried to see which settings could be different, so far without luck.
This also works if I switch to a YouTube brand account.
The problem remains, it don't work for all Google Accounts, not even when they're also Google+ accounts. The error seems to imply that the request is not made from a Google+ Account. Would be great if Google could clarify the exact reason.
Also, is it possible to programmatically make an account eligible to make a comment, after asking the permission from the account owner? How?
Edit 2
According to this page the reason for the error is this:
The YouTube account used to authorize the API request must be merged
with the user's Google account to insert a comment or comment thread.
How can this be done within the app?
Edit 3
I guess the answer can be found here. You're not able to comment without a YouTube Channel.
The problem is that you're not able to comment unless you have a private YouTube Channel or are logged in with your Brand Account. Using the model to login that Google gave in the instructions don't allow login with Brand Accounts, they're not visible in the account picker.
The result is that you're able to login with an account that have YouTube Brand Accounts, but you will not be able to comment using that accountand since you're not able to pick a Brand Account there is no way to solve this unless you ask users to also create a private Channel. The error message should say something like this:
The callers YouTube account is not a YouTube Channel Account.
See Question&Answers more detail:
os