Social Account Linking with Native ID/PW


I’m looking for some advice or suggestions on how to accomplish the following:

I need my users to be able to “link” their YouTube account to their native User in my app, but I’m struggling with the best way to do this. Using the standard “Signup/login with social media” option, the user is both signed-up AND logged-in with the same action. This can be ideal in some scenarios, but it’s not for my app.

I’d like all users to have a native ID/Password on my app; however, I need them to go through the OAuth process with YouTube such that my app can manipulate videos and data in their YouTube account. Ideally, this would work as follows:

  1. Register with my app in the conventional way - getting an ID/Password upon sign-up.

  2. Login to the app and then “link” their YouTube OAuth credential to their existing User profile.

This would allow the user to sign-in natively when returning to my app. For those who chose to link YouTube (not a requirement), it would enable certain features where I can do things like have the app manipulate their YouTube account.

If I let the user Signup/Login with YouTube initially, then I CANNOT set a password on the User profile - because there technically is none, and the “modify credentials” workflow expects an “Old Password” as part of setting a “New Password.” Perhaps there’s a way around this?

Otherwise, my next thought is to have them register regularly with an ID/Password and then, as I said, somehow “link” their YouTube OAuth credential. Will simply going through a “Signup/login with YouTube” workflow (after they’re registered and logged in with ID/Password) do this automatically, or is there another trick?