yt: Authorization code flow doesn't work
Followed the instructions pretty closely, got the code parameter back (after authorizing through Google’s OAuth2 interface) but the final account.email throughs a 401 exception:
Yt::Errors::Unauthorized ({"request_curl":"curl -X GET -H \"content-length: 0\" -H \"user-agent: Yt::Request (gzip)\" -H \"authorization: Bearer yKprP-9pG2O1h3IctXvqRcJOqqqmRJAfRjOa5rR1ZtvLOIYUNHgR7zmWygUp5vN10QIn0de0ZO6gQPEWWQCw7hxYWUfCInki-2y7kcSo\" -H \"host: www.googleapis.com\" \"https://www.googleapis.com/oauth2/v2/userinfo?key=AIXXXXXXXXXXXXXNXO-Xh9fisfr2u1c\"","response_body":{"error":{"code":401,"message":"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","status":"UNAUTHENTICATED"}}})
full interaction attached as an annotated screenshot:

About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (8 by maintainers)
Same problem here.
Trying to use the refresh token but got the same error.
{"error":{"code":401,"message":"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","status":"UNAUTHENTICATED"}}})Edit: This error only occurs when i call account.email or another account method. I needed the videos methods and those are fine