For the below request, the variable credential is a UserCredential object.
const credential = await firebase
.auth()
.createUserWithEmailAndPassword(email, password);
A UserCredential is made up of:
{
additionalUserInfo?: null | {
isNewUser: boolean;
profile: Object | null;
providerId: string;
username?: string | null
};
credential: AuthCredential | null;
operationType?: string | null;
user: User | null
}
Documentation: User and AuthCredential
As you can see from the documentation for User, the property stsTokenManager doesn't exist as it is an internal property.
This means you shouldn't be using it.
When you look at the source code of fireauth.AuthUser, the property is actually called stsTokenManager_, as defined here. It is accessed using user.getStsTokenManager(), as defined here.
So then, why does the console log it as stsTokenManager? This is because the fireauth.AuthUser.prototype.toJSON() method is called, which calls the fireauth.AuthUser.prototype.toPlainObject() method where it is exported as stsTokenManager, as defined here.
So you should be able to log the access token using either of the following:
console.log(result.user.getStsTokenManager().accessToken);
console.log(result.user.toPlainObject().stsTokenManager.accessToken);