I did some research and experiments on integrating LINE login with Firebase Auth using Flutter. I have some questions:
Looks like in Firebase Auth, there are
AuthProvider, and in Flutter source code, I also found anOAuthProvider. There you can createCredentialto include your idToken and access token. But I don't know how to specify theproviderIdin thatCredential. I guess it is not possible, because Firebase hasn't integrate LINE login. The client side api:logInWithCredentialcan ONLY work with Firebase supported login methods, and you have to enable them in your Firebase console. Am I right?So it looks like now I have to setup my own server to exchange LINE access token to Firebase custom token. In my server, I first verify access token and grab the LINE user profile, then I create a custom token, but there I have to decide a UID, which I have to use some pattern like
LINE:${LINE_UID}. This looks like some hacking, is there a better way?Admin API to create custom token only accept UID or optionally a user claim, I have no way to set its display name or some other basic info. So if I directly send the token with UID like
LINE:${LINE_UID}to a client, then the clientlogInWithToken, it will create a user without display name if it doesn't exist. The only workaround I can image is, in the server-side, generate theLINE:${LINE_UID}and look up it in Admin API, if it doesn't exist, then I create a user with a proper display name. This looks again not so good, because the document said if you dologInWithToken, it will create one if it is not there, and we cannot use that because I want to set it's display name when it is created. Any better solution?I want to link a user with multiple auth provider. I saw in the Firebase JWT, they are well included, that is cool. But those linked elements are user profile get via credential. So can we link a user to a LINE login? Which is not built-in Firebase Auth Provider? Is auth provider linking only valid for Firebase built-in provider?
Regards, Xiang.