i've deployed my app on firebase hosting and then i have bought a custom domain from Google Domains.
Then i have proceeded in this way:
Go to firebase hosting control panel
Click on Add Custom Domain
Then add my domain in like this my-domain.com
So, at this point firebase give me an A Type Record to add to my dns configuration in google domains that look like this: google domains setup
I leave empty the host name input, then i add google firebase ip infos in "value" input and save both on firebase and google domains.
But nothing happen.
Firebase told me that i require a configuration and domains says that is all okay.
firebase and domains response
It will take some time, usually in the magnitude of minutes (rather than hours, and certainly not days) to start working, but looking at the "google domains setup" screenshot, I believe there is an issue with the DNS setup as the screenshot shows an incomplete configuration.
For anyone else looking to resolve this, I will write the complete steps to help resolve the issue, for Firebase and Google Domains: retrace these steps, since any one of them could be the source of the issue.
First on Firebase Hosting:
Click add custom domain
Enter the custom domain or subdomain in the provided input box (note the difference!)
Lastly firebase will show a screen with details of how to configure the DNS. The "quick setup" is sufficient for new sites. It will look like this:
The next step is to enter this information into the domain name provider's console, in this case Google domains.
On Google Domains console:
Go to DNS configuration, then "custom records" section
Since this is a newly registered domain, there should not be existing records, but otherwise see the blue star note above: "Remember to remove..."
"create new record"
To get this last part correctly requires paying attention to the difference in how to configure domain/subdomain, so I will present them separately to highlight the difference:
Option A) subdomain configuration e.g. www.mywebsite.com
The entry in the DNS configuration should look as follows, where the data is the IPv4 address from Firebase. Note for "host name", enter the subdomain-part only:
Host name
Type
TLL
Data
www
A
3600
255.255.255.255
Option B) domain name configuration e.g. mywebsite.com
The host name entry is intentionally left blank, and data is the IPv4 obtained from Firebase.
Host name
Type
TLL
Data
A
3600
255.255.255.255
Save the DNS changes then wait. If you return to Firebase hosting, it may say "needs setup" ... then "pending" ... while these changes are being propagated and waiting for a SSL cert to be provisioned. The state should say "pending" very soon after applying the DNS changes (< 5 min).
Check the (sub)domain periodically in the browser, to see when it starts working (it took me about 20 minutes to give you some anecdotal metric, and it started working before the "pending" label had been resolved in Firebase). Eventually Firebase will switch the state label to "connected" to complete the configuration.
Related
I am working with Firebase Authentication email templates, where there is the option to use a custom domain after verification. I have followed all the steps, and it seems my domain will not be verified.
The steps were to input these DNS records
HOST
TYPE
VALUE
hopperchat.com
TXT
v=spf1 include:_spf.firebasemail.com ~all
hopperchat.com
TXT
firebase=hopperchat-cloud
firebase1._domainkey.hopperchat.com
CNAME
mail-hopperchat-com.dkim1._domainkey.firebasemail.com.
firebase2._domainkey.hopperchat.com
CNAME
mail-hopperchat-com.dkim2._domainkey.firebasemail.com.
And then wait 48 hours. After the time period ended, I received an error, saying Could not verify domain.
An image of my DNS records in Google Domains
P.S. In Google Domains DNS, the TXT files must be combined if they are from the same host. Also, the blank "Host name" in type "TXT" defaults to my domain (hopperchat.com). The "A" records are to connect to Firebase Hosting.
I have tried to change my DNS, and I expected Firebase to verify my domain, but Firebase did not.
I have purchased the domain name as domain-name.in.net from bigrock. But adding custom domain name in firebase, it only considering in.net and not considering domain-name.
Any solutions guys?
Due to above issue i am unable to verify ownership in firebase.
In the hosting section of the Firebase console, enter in the custom domain name of "domain-name.in.net". In your hosting provider add the A record with the IP address. Wait up to 24 hours for the record to propagate.
The subdomain should now correctly go to your Firebase app. Note, if you're concerned about the console saying "needs setup", ignore. It always says that and seems to be a bug with Firebase.
How to change the default Firebase Auth actions domain to my custom domain? I want to change it from reply#project-name.firebaseapp.com to reply#app.example.com but with another verification method for the domain rather than adding TXT & CName records to my DNS configuration.
I want something simple as adding a .txt file with the other project files and uploading it to the hosting. That's all because my current hosting doesn't support the TXT & CName records.
By the default Firebase Auth actions, I mean the password reset email, email verification, email address change, etc.
As a follow up to our discussion in the comments,
Since your project is being hosted on a Netlify subdomain, I found the following in their documentation:
To add a new DNS record:
Go to the Domains tab for your team.
Select the domain you want to edit.
At the bottom of the DNS records panel, select Add new record.
Choose the type of record to create from the menu and fill in the remaining options. The fields you need to fill out will depend on the
type of record you select.
Select Save to create the record and make the changes live. Remember, it may take up to a few hours for record changes to
propagate.
Note that you can host records for other services, such as your mail
provider or your backend API, with us as long as you host at least one
website with us that uses the domain.
If this isn't allowed, I would suggest getting a custom domain, and pointing both Firebase and Netlify to it. It's more professional than a hosted subdomain, and it'll stay yours forever. Doing a quick search, I found plenty of interesting and currently available domains relating to msk-apps.
I deployed my app and now I'm trying to add my custom URL. I followed Firebase's instructions and added their TXT record to my DNS (GoDaddy). But now Firebase is saying it's still not verified. I assume I'm doing something wrong, but there's not much here to mess up...
Per my comment above, the solution was to use the # sign in the Name column of GoDaddy, not the actual name of the domain that is owned.
To add a bit more information to this great solution for future reference.
DNS propagation can be monitored using a service like:
https://www.whatsmydns.net/
This will show you when your records are ready, thus can be verified by firebase.
As for subdomain, ie.
beta.example.com
The value would be 'beta' instead of '#' or 'example.com' for the godaddy DNS records.
TXT GoDaddy TTL time is approximately 2 hours, Please re-verify after 2 hour firebase.
I see you fixed your problem but for anyone trying to link their godaddy domain with the reset password/ verify email service in Firebase Auth you need to remove your domain name from the CNAME record name.
Firebase gave me firebase2._domainkey.mydomain.com and in godaddy CNAME record name I only used firebase2._domainkey and it verified my domain.
In case you have to set up the acme-challenge for your https certificate you probably may get something like this:
_acme-challenge.domain.com
just remove domain.com
in the case, you might have a subdomain
_acme-challenge.subdomain.domain.com
change it only to
_acme-challenge.subdomain
it will work in a couple of hours
For TXT records use # for host instead of mysite.com
and for
A record, if it is subdomain, just add subdomain in the place of host. for example, https://subdomain.mysite.com => just add "subdomain" in Host of your DNS records in godaddy.
I am using Firebase Auth signInWithPopup() which is absolutely great. But
when initially configured, the popup reads:
Choose an account to continue to myApp-123.firebaseapp.com
I would really like it to read:
Choose an account to continue to myApp.com
How can I make the popup show my own domain?
In my solution that follows I should say that the steps I followed worked. It is possible that I did something that it not absolutely required, but to my knowledge and at this time, I have not broken anything.
This workflow (and the documentation) is a bit broken up because you must adjust both your Google Cloud Platform (GCP) credentials and the Firebase authentication. Documentation was provided by each side of this workflow but I was not able to find a document that covered the entire workflow to make this substitution.
GCP Console Setup
I first adjusted my GCP credentials for the OAuth Client:
Go to the GCP console > APIs & Services > Credentials page (https://console.cloud.google.com/apis/credentials?project=_ and select your project)
At the bottom of the page, find "OAuth 2.0 client IDs". There should be an entry titled "Web client (auto created by Google Service)"
To the right side of page click on the edit icon (pen), which opens the configuration page.
Under "Authorized JavaScript origins", you should see your yourFirebaseApp.firebaseapp.com domain. Click "+ Add URI" and add your custom URI. This should be an "https" domain, so use https://myApp.com
Under "Authorized redirect URIs", you should see https://yourFirebaseApp.firebaseapp.com/__/auth/handler. (The __/auth/handler bit on the tail is the auth callback that Firebase provides). Click "+ Add URI" and add your domain, with __/auth/handler at the end. (For example: https://myApp.com/__/auth/handler)
Click Save
Go to the OAuth Consent Screen (https://console.cloud.google.com/apis/credentials/consent/edit?project=_). Add your custom domain to "Application Homepage link", and fill in the "Application Name" and "Logo", and "Application Privacy Policy link" with custom values for your app.
Firebase Console Setup
Then, you'll need to add your custom domain to the Firebase auth authorized domain list:
Go to the Firebase Console > Authentication > Sign-in Methods page (https://console.firebase.google.com/project/_/authentication/providers and select your project)
Under "Authorized Domains" you should see localhost and the default yourFirebaseApp.firebaseapp.com domain. Click the "Add Domain" and enter your custom domain name, then click add.
Web App Setup
You will likely remember the block of code that you copied from your firebase project and pasted into the code from which you compile and deploy your Web App. (Some people use the hosting default init.js script - if you do, go back and setup your app using the config snippet instead)
Find the "authDomain" field in the code snippet, and change it to your custom domain, then re-deploy.
This procedure worked for me and my project, I have posted this in the hopes that these instructions may be refined via feedback from others performing this or similar operations.
I asked firebase support and got the following reply. Items in italics are my additions. This is more or less the same as Done's answer but with a custom domain. You do not need to host your app on Firebase.
--
Hi Jayen,
Thank you for reaching out. I'll be happy to assist you.
In order to update firebase-project-id.firebaseapp.com in the OAuth consent screen, you need a custom domain with Firebase Hosting (Firebase Console > Hosting > Connect Domain). This is because https://firebase-project-id.firebaseapp.com/__/auth/handler is hosted by Firebase Hosting. You need to point your custom domain to firebase-project-id.firebaseapp.com.
When connecting the custom domain, if you are not hosting your app on firebase, use a new subdomain (e.g. app.yourdomain.com) and do not redirect it. Firebase will prompt you to add a DNS entry and take of the SSL certificate automatically.
After connecting your custom domain to your Firebase project, you should also follow the steps below:
Go to the Firebase Console > Select Project > Authentication > Sign-in method > Facebook > Copy the URL under 'To complete setup, add this OAuth redirect URI to your Facebook app configuration.'
It will look something like https://firebase-project-id.firebaseapp.com/__/auth/handler
Replace the project ID with your custom domain. It will look something like: https://yourdomain.com/__/auth/handler
Go to the GCP Console > Select project > API Manager > Credentials > Add the link in #2 to the 'Authorized redirect URIs'
Then ensure to use yourdomain.com as the authDomain in your app's configuration instead of firebase-project-id.firebaseapp.com
firebase.initializeApp({
apiKey: ....,
authDomain: 'yourdomain.com',
...
});
Let me know if you have any other questions regarding this.
Regards,
Aye
--
In my case, yourdomain.com is where I host my site, so I used app.yourdomain.com where I needed it.
Firebase Hosting URL
handler url: https://app.yourdomain.com/__/auth/handler
GCP Credentials
Choose the right one under OAuth 2.0 client IDs . The client ID will match the one you have configured Firebase with in your code.
authDomain: "app.yourdomain.com"