Cannot add TXT records to firebase DNS domain - firebase

I have a firebase domain which looks like : https://my-app-id.firebaseapp.com/
I'm trying to create a Dynamic Link with this domain, but it fails on the Verify step.
It says "We couldn't verify your domain web.app. Check your settings and try again."
I cannot find any settings where to add this TXT record into the Firebase integrated domain, all I can find is for a custom domain, but this is not custom, it is from firebase.
Any ideas?

The TXT record is need if you have a custom domain.
If you don't have a custom domain you must use one provided by google, which is something like example.page.link
https://firebase.google.com/docs/dynamic-links/

Related

How to change the default Firebase Auth actions domain to my custom domain?

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.

Firebase hosting not validating TXT record in GoDaddy

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.

Firebase Auth CNAME update requirement without top domain

I've recently received an email from Firebase, that in order to use authorization service email templates without them falling in spam folder, I need to add new CNAME records to custom domain defined for that Firebase app.
However those records are in format: firebase2._domainkey and not firebase2._domainkey.my-custom-domain-name-something.com
I didn't know it's possible to add a record in DNS that doesn't involve domain name itself.
Is this a documentation error or I'm missing something?
Don't worry, you only have to include the partial domain. The fully qualified hostname will have the custom-domain-name-something.com appended to it.
You can check out this small tuto for more info

How to replace the myApp-123.firebaseapp.com with my custom domain myApp.com

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"

How to update new API key on current firebase project

For some reason, my firebase project apikey associate with database changed. I can still create another api key, update into the application.
But when user try to reset password, the link use the old key and lead to "Your request to reset your password has expired or the link has already been used" (I think I read this problem somewhere and now I found the reason).
Is there anyway to update new api key for an existing firebase project?
Thank you
Somehow, my original apiKey was recovered. You can find the original key (which were deleted from console.google.com) associated with the application on the main firebase page, through
Overview > Project settings > GENERAL
Basically, when users requested to recover the password, firebase will send an email with recovery link. If you have a look at the link, you will see the API included in the link is the one that no longer exists.
I recommend you to contact firebase support. I don't have an official way to solve the issue but here is quick I can think of, following as
Create new API at console.google.com > choose your firebase project
Create a page with a function that can read URL parameters. Make it receive firebase recovery password URL and replace dead API with new
one, then redirect you to new firebase recovery password URL
Edit email template by adding the page you created on step 2, with firebase recovery full URL as a parameter
To be more accurate, here is an example.
I have my project called "MyFirebaseProj", my domain is "example.com"
I go to console.google.com, choose "MyFirebaseProj", on API Manager panel, choose Credentials > Credentials. Click on Create credentials > API Key. So I got a new API key call "MyNewLongAPI".
I created a recover-password.html password and have this javascript function https://codepen.io/hieunc229/pen/mWwVbv (this one will read the firebase url, get oobCode and generate new URL). Edit the javascript so it will redirect the user to new URL. Upload this one into my host (mydomain.org/recover-password.html)
On Firebase console, Authentication > Email Template > Reset Password. Change the link to something like
<a href='http://example.com/recover-password.html?url=%LINK%'>%LINK%</a>
Then save it
Now when user go into your recover password page, they will be redirected into firebase url with new API and it should works
Hope it helps!
If anyone run into the same issue, as I get in touch with Firebase team and they are investigating about it. Currently there haven't been a way to help it.

Resources