Home > Blockchain >  Using a custom domain with Firebase OAuth authentication in Swift
Using a custom domain with Firebase OAuth authentication in Swift

Time:10-07

We have an iOS app that authenticates users using Firebase Authentication and an OAuth provider. When the authentication web view opens, the app first accesses *project*.firebaseapp.com before redirecting to the relevant OAuth provider page (e.g. Microsoft login).

We would like to use a custom domain rather than the firebaseapp.com domain. We have set up the required firebase hosting for the custom domain login.ourappdomain.com but it does not seem possible to provide the custom domain in a native app as you can in a web app.

Google's documentation shows how to set the authDomain option when configuring the Firebase app in a web app-

import { initializeApp } from "firebase/app";

const firebaseConfig = {
  apiKey: "...",
  // By default, authDomain is '[YOUR_APP].firebaseapp.com'.
  // You may replace it with a custom domain.
  authDomain: '[YOUR_CUSTOM_DOMAIN]'
};
const firebaseApp = initializeApp(firebaseConfig);

There does not seem to be an equivalent authDomain property on the Swift FirebaseOptions object.

Are custom domains not supported in native apps?

CodePudding user response:

Yes, you were right there is no equivalent authDomain property on the Swift

Both native Firebase Android/IOS apps do not support the authDomainoption at this time. And this is a known issue, There is a Feature Request for authDomain in the Github repo but currently there is no information on the priorities of this Feature Requests.

If your willing to file feature request you can add your concern in that github thread or you can raise new feature requests here

  • Related