Action URL changing based on ActionCode settings when sending passwordless login email - firebase

I have 2 frontend interfaces for my firebase project (both housed in the same firebase app in the backend). One is web and one is for iOS.
I'm trying to create passwordless sign-in functionality for the iOS app and have gone through all setup guides regarding setting up dynamic links, custom domains etc.
I have gotten to the point where both the web and iOS apps can both send the email successfully, however the root domain changes between the emails sent from each platform. An example is below:
Web App: Sends login email via firebase.auth().sendSignInLinkToEmail and the resulting root domain in the email is https://app.domainname.com (this is correct and is what is set up as a whitelisted domain/dynamic link domain in firebase)
iOS App: Using the same function, the resulting root domain is https://domainname.com (incorrect). This results in the link going to the non-firebase, generic website and breaking the flow.
If I add the app subdomain back to the link generated by the iOS email, the dynamic link does then work, so the issue seems to be isolated to this root domain change specifically.
Upon further investigation, the issue seems to be related to the action code settings.
When the iOS.bundleId property is set, or handleCodeInApp is true, the incorrect root domain is used. This is true for either the web app or the iOS app.
I have done a project find on domainname.com in both projects (my iOS app is an ejected expo app so the search included Xcode files for this one) and can't find any instance of the subdomain being missing in either codebase (or the backend codebase for that matter) and am therefore at a loss.
I've looked throughout my firebase settings and can't find any instance of the incorrect one appearing, but am unaware of a search functionality on the platform to be certain. The Action URL (%LINK%) setting in Authentication->Templates appears to be the correct URL.
I am hoping to get to the point where irrespective of the action code settings, the same, correct root domain is used. I assume this is a configuration issue but am at a total loss about how to resolve it, so any help would be appreciated.
For reference, the action code settings in use are below:
var actionCodeSettings = {
url: 'https://app.domainname.com',
iOS: {
bundleId: 'com.domainname.app'
},
handleCodeInApp: true
}
Thanks!

In case anyone finds this in the future, it turned out for me that the issue was due to a combination of an undocumented lack of support for custom domains in dynamic links in react-native-firebase, alongside the fact that the library will only send the email links using the first selected domain in your Firebase Dynamic Links settings.
At the time of writing, the solution was to simply delete all other domains from my Dynamic Links settings, leaving only PROJECTNAME.page.link, so that this was the one that got used by the library. From there everything worked as expected.

Related

React Native - Dynamic link not persisting through install process

I have a small React Native app for which I have a series of Firebase dynamic links. When the app is installed, the links work perfectly in directing users to the relevant screen defined in the dynamic link
However, if the user does not have the app installed when the dynamic link is followed, the route defined in the dynamic link does not persist.
Is it possible to persist the deep link during the installation process?
I've tried a basic deep link URL like https://fakedomain.org/upload as well as using the ?link=https://fakedomain.org/upload param and neither seem to work.
To answer your question, it is possible to persist the link after installs but it won't be %100 successful because of some limitations on the iOS side. You can check the flowcharts in here
There could be a couple of reasons for it not to work after the app installation. Since no code is provided I'll assume you are listening to the dynamic link with onLink for the app's active state and checking the initial link with getInitialLink when your app is in the quit state.
Persisting the link after app installation involves the clipboard in iOS so make sure the problem is not related to new iOS 16 copy/paste permissions.
Your navigation library might be trying to navigate to the route from the link before your navigation stack is initialized.
If the problem occurs only in one platform it might indicate a problem in your native setup like maybe related to LinkingManager etc.
If you are using a custom domain, you should double check your Associated Domains and AndroidManifest settings.

Firebase page.link reported in Play console with domain failed validation, deep links not working - how to verify ownership?

I am getting this error message, and don't understand what I need to do to fix. How do I verify ownership of a Firebase deep link?
Deep links not working
Users will not go directly to your app from links associated with this path, but will see the app picker or be directed to the web browser. Once you have fixed these issues and published a new version, users need to update their app before the links will work.
FIX DOMAIN ISSUES
error
1 domain failed validation
brightness_1
Fix domain issues by verifying ownership of web links associated with this path
Get SHA256 Hash from release key file. You can also find sha256_cert_fingerprints from above assetlinks.json.
Go to the firebase console, select your project, add the SHA 256 key.
Open your dynamics link domain - https://xxxx.page.link/.well-known/assetlinks.json
Upload new version. It will work.

Firebase Action URL in development and production

I have a custom action URL for password reset in my firebase project.
Here, I'm using the dev mode URL: http://localhost:3000/auth/reset-password
Now if I want to deploy the app, it looks as if I will have to change the URL back to my custom domain name like www.mydomain.com/auth/reset-password.
Will I have to do this every time, or is there any work around?
What I really did was that I used nextjs to check if I was in production or development, and based on that, I navigate my users. On the firebase dashboard, I didn't do anything.
I used the ResetPassword function and set the property of the actionUrl based on the above condition.

OAuth using meteor in Cloud 9

I am trying to sign users into my application using an external app. In this case, facebook. I am using cloud 9, so I don't have the meteor app(ide) downloaded on my pc. Anytime I try to use facebooks activation, i get this error:
"Given URL is not allowed by the Application configuration: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains."
I already created my app on facebook. The uri uses: http://0.0.0.0:8080
That's not what I set it to use on facebook. Any pointers on fixing this?
Found the answer. You can export your app so that it runs on the right url you want it to.
Command: $ export ROOT_URL='https://-.c9.io/'
This gets rid of 0.0.8080 or whatever.
Check this question for reference: Meteor accounts-twitter unable to get working

Correct redirect URI for Google API and OAuth 2.0

I am making an application with the Google Maps API. I want to be able to have one person on a computer, watch what another person has edited to a map. I am thinking of passing information of the map to a Google Fusion Table. The other person will be able to see everything as a layer. I would like for the program to just run from the user's browser and not build a website for it.
To edit the fusion tables, I need to gain access/tokens. I am currently trying to use these there JavaScript to accomplish this. ScriptSample.html, oauthWindow.html, and gwt-oauth2.js. This is the working example.
When I run them, I get am error that says the redirect URI is incorrect. It says the file I use to redirect does not have authority. My first obvious question is:
How do I give that file authority to redirect?
In my API console, I have it set up as a client-side web application. Should I change it to an installed application?
Currently I have the following settings:
my JavaScript origin is: https://localhost
redirect URI: https://localhost/oauthWindow.html
Thanks
There's no problem with using a localhost url for Dev work - obviously it needs to be changed when it comes to production.
You need to go here:
https://developers.google.com/accounts/docs/OAuth2
and then follow the link for the API Console - link's in the Basic Steps section. When you've filled out the new application form you'll be asked to provide a redirect Url. Put in the page you want to go to once access has been granted.
When forming the Google oAuth Url - you need to include the redirect url - it has to be an exact match or you'll have problems. It also needs to be UrlEncoded.

Resources