snippets-web icon indicating copy to clipboard operation
snippets-web copied to clipboard

Improve accuracy of account linking snippets for Auth

Open samtstern opened this issue 3 years ago • 0 comments

This (old) email thread explains some of the shortcomings with our snippets on this page: https://groups.google.com/d/msgid/firebase-talk/86666e16-7489-43fd-a357-96b39d56d546%40googlegroups.com?utm_medium=email&utm_source=footer

The file in question is: https://github.com/firebase/snippets-web/blob/cee9068490fbfb03c123fbda87bc08a73a122520/auth/link-multiple-accounts.js

To quote the thread:

line 128 I believe should be:

repo.delete(prevUserData);

line 153 I don't think is needed or works as it's out of scope

line 140 & the chained logic I'm unsure of. I'm approaching differently since I'm only going from anonymous to permanent & I don't need the anonymous account anymore at this point so I delete it & merge data into the signed in account.

I know you're keeping it brief but I think this could fail if the linked account is already linked so might at least want a note about it 🤷‍♂️ Also I haven't tried in this context, but once you've linked the credential can't you just merge w/out signing in again?

samtstern avatar Jul 16 '21 14:07 samtstern