Reputation: 3527
In android app the user is allowed to use Linkedin as signin option using Firebase Functions. User sends linkedin token to firebase function and as a result it receives AdminSdk
generated Custom token.
Now as we know the token can be used for signin with
mAuth.signInWithCustomToken(mCustomToken)
. But I cannot find a way to use the custom token to generate AuthCredential
.
There is OAuthProvider class which can generate AuthCredential but re-authentication fails.
getCredential(String providerId, String idToken, String accessToken)
Any solution to this problem?
Upvotes: 1
Views: 836
Reputation: 30838
Unfortunately Firebase Auth does not offer a way to re-authenticate with a custom token. You can request this as a feature: https://firebase.google.com/support/contact/bugs-features/
Right now, you have to basically use signInWithCustomToken
again. However, you will be signing out the original user and there is also a risk the user signs in with a different account. You will need to retain the original uid
to confirm the new signed in user is the same one (has same uid
). If the same user signs in again, you also have to get a new reference to the currentUser.
Upvotes: 5