This is currently possible?
As alternative I thinking in implement an lambda to handle this case in this way:
firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idToken) {
// Send token to your backend via HTTPS
// ...
}).catch(function(error) {
// Handle error
});
3) if the user the app 2 is not logged, check the HEADER for the token
4) Send the token to the lambda or backend via HTTPS
5) Verify the token in the lambda
# id_token comes from the client app (shown above)
decoded_token = auth.verify_id_token(id_token)
uid = decoded_token['uid']
6) Create a new token using firebase admin, and return it.
uid = 'some-uid'
custom_token = auth.create_custom_token(uid)
7) Sing in using custom token on the app2 client
firebase.auth().signInWithCustomToken(token).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// ...
});
If this approach is O.K don't introduces security issues?
PD: I have old django app, and I'm using the strangler pattern to migrate the current users accounts, the strangler facade will be
auth.example.com that will call to django rest framework to create the session to. I doing good with the approach here?