Note: To my knowledge, it's not possible to use your custom authentication system directly within Firebase.
Assumption: You have an authentication server which Firebase Admin SDK (can be/has already been) integrated.
You need to create custom tokens in order to use your authentication within the Database/Storage:
https://firebase.google.com/docs/auth/admin/create-custom-tokens
Once authenticated, this identity will be used when accessing other
Firebase services, such as the Firebase Realtime Database and Cloud
Storage. Furthermore, the contents of the JWT will be available in the
auth object in your Firebase Realtime Database Security Rules and the
request.auth object in your Cloud Storage Security Rules.
Omitting Java and Python from the upper link
In server:
// Step 1: Your client has sent the credentials.
// Step 2: Fetch the client's unique id, and create a custom token with the Admin SDK.
var uid = "some-uid";
admin.auth().createCustomToken(uid)
.then(function(customToken) {
// Send token back to client
})
.catch(function(error) {
console.log("Error creating custom token:", error);
});
Then in iOS part:
// Step 1: Login with your own authentication system.
// Step 2: Send your credentials to your server, and fetch the customToken.
// Step 3: Sign in with FIRAuth:
[[FIRAuth auth] signInWithCustomToken:customToken
completion:^(FIRUser *_Nullable user, NSError *_Nullable error) {
// ...
}];