Peeja
Peeja

Reputation: 14284

YouTube OAuth: Why do some accounts give me "Invalid Credentials"?

I'm using OmniAuth in Rails to authenticate users through YouTube OAuth.

I have several Google/YouTube accounts. Two of them log in just fine. Two of them fail with "invalid_credentials".

I'm not entirely sure what that error means; it doesn't appear in the OAuth 2 spec.

I'm successfully logged into all four of these accounts on the Google side using multiple sign-in, so it's not that I'm logging in incorrectly. Two of the accounts work, so it's not that my API key is bad.

What's going on?

Upvotes: 0

Views: 5650

Answers (1)

Peeja
Peeja

Reputation: 14284

I've got the answer.

They're returning invalid_credentials because there's no YouTube account associated with the user who's trying to log in.

But! I did make sure to log into YouTube with those accounts before trying to log into my app. Turns out that's not enough.

In this brave new world, Google users can log into YouTube without actually creating a YouTube account. In the YouTube UI, a YouTube account is a "channel". It is now possible to log into YouTube and not have a channel.

To create a channel, click the user menu (represented by your profile picture) in the top-right corner of the page and click "My Channel". You'll be prompted to create one.

Then you can log in with YouTube OAuth.

Upvotes: 8

Related Questions