Auth - Migrating to v11.0
Email Link Authentication
With the deprecation of Firebase Dynamic Links you will need to change the way you handle email link authentication as you will no longer receive the DynamicLinkEvent.RECEIVED
event.
You should remove the Firebase Dynamic Links extension from your application as it is no longer required for email link authentication.
- APM
- Manual
To remove the Firebase Dynamic Links extension using the AIR Package Manager (apm
), you can run the following commands:
apm uninstall com.distriqt.firebase.DynamicLinks
apm generate app-descriptor
</TabItem>
<TabItem value="manual" >
Remove the com.distriqt.firebase.DynamicLinks
extension from your application descriptor and remove the extension from your project.
Remove any entries in the manifest that relate to the Firebase Dynamic Links extension.
Ensure you remove the com.distriqt.firebase.DynamicLinks
extension entry from your extensions
list in the application descriptor.
In the past you would have used the DynamicLinkEvent.RECEIVED
event to handle the email link authentication, however now you will need to use the FirebaseAuthEvent.EMAIL_LINK_RECEIVED
event instead.
FirebaseDynamicLinks.service.addEventListener( DynamicLinkEvent.RECEIVED, dynamicLink_receivedHandler );
You should replace it this with the following code to handle the email link authentication:
FirebaseAuth.service.addEventListener( FirebaseAuthEvent.EMAIL_LINK_RECEIVED, emailLink_receivedHandler );
function emailLink_receivedHandler( event:FirebaseAuthEvent ):void
{
// Handle the email link authentication here
if (FirebaseAuth.service.isSignInWithEmailLink( event.link ))
{
// Proceed with email link sign-in
FirebaseAuth.service.signInWithEmailLink( email, event.link );
}
}
You will need to ensure that you make some changes to your manifest to ensure that the email link authentication works correctly.
With dynamic links you would have added the following to your manifest:
<activity>
<intent-filter>
<action android:name="android.intent.action.MAIN"></action>
<category android:name="android.intent.category.LAUNCHER"></category>
</intent-filter>
<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="airnativeextensions.com" android:scheme="http"/>
<data android:host="airnativeextensions.com" android:scheme="https"/>
</intent-filter>
</activity>
You will need to change this to the following:
<activity>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="<PROJECT_ID>.firebaseapp.com"
android:pathPrefix="/__/auth/links" />
</intent-filter>
</activity>
Follow the email link integration guide to set the host value (<PROJECT_ID>.firebaseapp.com
) or your custom domain" correctly.