This is not supported out of the box. What you can do is the following (setting the order is required, basically switching the order):
- Log in using user auth using slack: (the uid used here in the user auth account may be the same as the slack user ID).
- linkWithPopup / Redirect / Credential using a Google provider or credentials for an existing slack user user.
If you insist on the proposed thread, you can do the following:
- Log in to Google first (uid highlighted).
- Log in using Slack (weak OAuth credentials obtained).
- Tick ββthe Firebase ID token and skip the credentials on your server.
- Check the Firebase identifier token, the endpoint of the slack userinfo request, to get weak user data, including the slack identifier.
- Save the hash map with Slack ID as the key, and Firebase uid as the value, another hash map with firebase uid as the key and weak identifier as the value.
- Configure your own token using firebase uid, set the slack custom attribute (slack: {Slack Identifier}).
- Sending a custom token to the front end and signInWithCustomToken (the id of the slice will now be available in the token)
- The account is now linked to an existing account.
The next time the user logs in with Slack:
- Send weak OAuth credentials to the server.
- Request a userinfo slice to get a weak identifier.
- Check the hash map using the hidden identification key for the corresponding firebase uid.
- Mint custom token with uid firebase, add a weak identifier as a custom attribute.
- log in with a custom token on the client.
If the user logs in with Google.
- Send the firebase identifier token to the server.
- Check the identifier token, find the corresponding snap identifier in the hash map using the uid firebase keys.
- Mint custom token with Firebase uid and weak identifier as a custom attribute.
- log in with a custom token on the client.
source share