I'm trying to create a playlist on YouTube using the YouTube Data API v3 via and Android app. When I have a Google Account that is linked to YouTube everything works fine. However, if I have a Google Account that is unlinked then I get the following response
com.google.api.client.googleapis.json.GoogleJsonResponseException: 401 Unauthorized
{
"code": 401,
"errors": [
{
"domain": "youtube.header",
"location": "Authorization",
"locationType": "header",
"message": "Unauthorized",
"reason": "youtubeSignupRequired"
}
],
"message": "Unauthorized"
}
Is there a way to fix this issue through the API itself, or is there an Intent I can launch on Android to solve this issue?
If I go to the YouTube website directly, when I try to create a playlist there I'm presented with this dialog to create a linked account also.
Are these 2 solutions from 2013 still the only way to achieve my outcome?
https://stackoverflow.com/a/14492382/2205809
https://stackoverflow.com/a/16024919/2205809
The second one seems quite brittle in that I have to check for a web flow for a specific URL, if Google ever changed that it'd break my app.