I am sorry i have much trouble understanding Firebase Dynamic links.
My use case is : a user wants to reset his password from the mobile app (or send an email verification).
- The request is made using Firebase Authentication with a custom handler (with custom domain : https://example.com/auth)
- The
ActionCodeSettingslooks like :
final ActionCodeSettings codeSettings = ActionCodeSettings(
url: 'https://links.example.com/auth?email=$email',
iOSBundleId: Constants.iosBundleID,
androidPackageName: Constants.androidBundleID,
androidInstallApp: true,
dynamicLinkDomain: "links.example.com",
);
- The user clicks on the link he received by email and gets redirected to the website (hosted by Firebase Hosting under : example.com)
- When the user has finished resetting his password, i would expect to redirect him by "launching" the
continueUrlthat should take him back to the mobile app.continueUrl: 'https://links.example.com/auth?email=$email'
However this doesn't work so i am guessing that i am doing something wrong somewhere.
- In my iOS config, i have added the
Associated Domainsas :applinks:links.example.com.
In theInfo.plistfile i have added :
<key>FirebaseDynamicLinksCustomDomains</key>
<array>
<string>https://links.example.com/auth</string>
</array>
(and have also tried with : <string>https://links.example.com</string>)
- In my Android config I have added this to my
AndroidManifest.xml:
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="links.example.com" android:scheme="https"/>
</intent-filter>
Fun fact, on Android after the above steps are completed (on website from the smartphone), if i launch the continueUrl it prompts the user whether to redirect back to the app or stay on the browser to open the URL.
I have of course created a sub-domain : links.example.com in the Firebase Dynamic links console as an URL prefix.
Here are my questions :
- Is the
continueUrlsupposed to redirect back to the app ? - In the
ActionCodeSettingscontinueUrldescribed above is correct? I see in the documentation always usingexample.comas thecontinueUrl, but it would be in conflict with the custom domain used for hosting right ? So i have putlinks.example.comas thecontinueUrland the custom Firebase auth handler isexample.com/authto indeed redirect to the correct web page in my website. - What is the Hosting
firebase.jsonconfiguration for such case ? - The final link looks like this :
https://example.com/auth?mode=resetPassword&oobCode=T0qn8aj_p7TJBWyE5eUh7_7ZwIqwtJ7Q-i8LDf4QrIsAAAF_u6Bi6Q&apiKey=AIzaSyAzPqhZFKAyfQDeN4DGGjI9VCTEBe_mLc4&continueUrl=https%3A%2F%2Flinks.example.com%3Flink%3Dhttps%3A%2F%2Flinks.example.com%2Fauth%3Femail%253Dtestmail12%40gmail.com%26apn%3Dcom.example.android%26amv%26ibi%3Dcom.example.ios%26ifl%3Dhttps%3A%2F%2Flinks.example.com%2Fauth%3Femail%253Dtestmail12%40gmail.com&lang=fr
- Do you see anything wrong or missing ? Something that would prevent the mobile app redirection after the operation completes ?
- What should I do with the
continueUrlparam to gets redirected to the app ? Is it automatically done after some event or should the developer writes code to "push" a new web page containing this link and it will see automatically that's not a link to handle in a web page, thus redirect to the mobile app ?
Thanks a lot in advance for any explanations on how this works !