Skip "open link in app" page when using firebase email link authentication - ios

Is it possible to skip the following interstitial page when using Firebase Email Link Auth (passwordless)? Currently this page is shown regardless of whether the app is installed or not. I'd prefer to skip it and open the app directly if installed or else redirect to the App Store page.
Here's the code I'm currently using:
let actionCodeSettings = ActionCodeSettings()
actionCodeSettings.url = URL(string: linkToAppStorePage)!
actionCodeSettings.handleCodeInApp = true
actionCodeSettings.setIOSBundleID(Bundle.main.bundleIdentifier!)
Auth.auth().sendSignInLink(toEmail: email, actionCodeSettings: actionCodeSettings) { error in
...
}

Related

How to use Branch.io to create a referral program for iOS app?

I have not been able to find a complete guide to creating a useful referral program in the Branch.io documentation. At the moment, I have the iOS SDK integrated as well as the dashboard setup correctly. I am using BranchUniversalObject and BranchLinkProperties and then showing the share sheet when a user attempts to share their referral yet when I click on the shared link, there is no reference to the user who referred the new user. I am setting a custom parameter referringUserID but that doesn't seem to get passed into the deep link when the user launches the app after download. I am also setting the canonicalIdentifier for the BranchUniversalObject. Is it better to generate a unique URL upon user account creation then use that from the share sheet and compare the +non_branch_link upon user launch? The code below is what I have for the current implementation of how we display the share sheet. What is the proper way to share links on iOS to track actual referrals?
let branchUniversalObject = BranchUniversalObject(canonicalIdentifier: Session.shared.userId!)
branchUniversalObject.title = "My Share Link"
branchUniversalObject.contentDescription = "Share"
// Feature (utm_medium) = marketing, referrals
// Channel (utm_source) = sticker, referral link, etc
// Campaign (itm_campaign) = launch, holiday season, etc.
// Tags = June Offer, Summer, Launch Promo
let branchLinkProperties = BranchLinkProperties()
branchLinkProperties.campaign = "Referral"
//branchLinkProperties.channel = "Referral Link"
branchLinkProperties.feature = "referrals"
branchLinkProperties.addControlParam("referringUserID", withValue: Session.shared.userId!)
branchUniversalObject.showShareSheet(
with: branchLinkProperties,
andShareText: "",
from: viewController,
completion: nil)

iOS Firebase OTP verification without Sign Up

I need help verifying the OTP with Firebase.
I Managed to receive a SMS with the OTP but when I verify it I get automatically signed up and I only know if the OTP was valid if I signed up - else I get a popup like "invalid otp".
How can I manually validate the otp? My goal is to open another screen where the user puts in more information.
func verifyCode(){
let credential = PhoneAuthProvider.provider().credential(withVerificationID: self.CODE, verificationCode: code)
print(credential)
loading = true
//here i just want to verify my OTP without signing in...
Auth.auth().signIn(with: credential) { (result, err) in //here i am signing in...
self.loading = false
if let error = err{
let generator = UINotificationFeedbackGenerator()
generator.notificationOccurred(.error)
self.code = ""
self.errorMsg = error.localizedDescription
withAnimation{ self.error.toggle()}
return
}
self.gotoRegistration = true
withAnimation{self.status = true}
}
}
There is no way to use Firebase Authentication's phone/OTP provider without automatically signing the user in.
But the fact that the user is signed in to Firebase, does not mean that you have to grant them access to all parts/data in your app. If you want them to provide more information, you can do so before or after signing them in to Firebase, and make it part of the same sign-up flow as far as the user is concerned.
So something like:
// Sign the user in with Firebase
// Check if the user has provider the additional registration information
// If not, send them to the registration information screen
// If so, send them to the next screen of the app
You can also enforce these rules in your back-end code, or (if you use one of Firebase's back-end services) in the server-side security rules.

I am getting Invalid Dynamic Link when clicking to the Sign-in link received through email

I am getting Invalid Dynamic Link when clicking to the Sign-in link received through email.
actionCodeSettings.url = URL(string: "https://caxxxxxxxxxxxant.page.link") //my domain prefix
actionCodeSettings.handleCodeInApp = true
actionCodeSettings.setIOSBundleID(Bundle.main.bundleIdentifier!
But when I provide the url as :
actionCodeSettings.url = URL(string: "https://caxxxxxxxxxant.page.link/open")
with custom url scheme i gave while making Dynamic Link under the domain, it's now navigating me to my app with error 'error in sign-in' by going else part of the below code. *
if Auth.auth().isSignIn(withEmailLink: link) {
guard let email = UserDefaults.standard.value(forKey: "Email") as? String else {
print("Error signing in: email does not exist")
return true
}
}
else{
print("error in sign-in")
}
return false
}
The link I am getting while receiving the dynamic link in app delegate restorationHandler: method is
<https://caxxxxxxxxxxxxant.page.link/?link=https://sxxxx-axxxxt-exxa.firebaseapp.com&isi=14xxxxxx8&ibi=com.cxxxxxr.sxxxxxt&st=Eagle+Eye+Sales+Assistant+App&sd=Now+you+can+get+all+the+Eagle+Eye+documents+and+information+within+a+fingerprint.&cid=5xxxx60xxx558&_osl=https://caxxxxxxxxant.page.link/open&_fpb=CJxxxxxHQg==&_cpt=cpit&_iumenbl=1&_iumchkactval=1&_plt=895&_uit=1062&_cpb=1>
I guess this is because my incoming link doesn't contain email with it.
Please help me, how can I get my link authenticated in Auth.auth().isSignIn(withemailLink : Link) method. How can I get the link with email.
Any help will be appreciated.
First of all, Firebase Auth doesn't support custom FDL domains with paths.
Second, if you want to use a custom FDL domain, you need to set actionCodeSettings.url to a fallback URL in case the user clicks the link on a different device (where the iOS app is not installed). You will need to set the FDL domain caxxxxxxxxxxxant.page.link in actionCodeSettings.dynamicLinkDomain.

How do I report error messages from PayPal iOS SDK to users?

The app I am administering has used the PayPal SDK for iOS, and this works fine for the most part, except that if a user tries to login and gets an error, the error is not reported to the user.
For example, if I use incorrect login credentials, I'll get this error message:
2018-07-12 10:21:28.316449-0400 AppName[52601:6030601] PayPal SDK: Request has failed with error: invalid_user - Incorrect username/password. Please try again. (401) | PayPal Debug-ID: a1f66774362f, a1f66774362f [live, PayPal iOS SDK 2.17.0] | Details: (
Ultimately, when I try to login with these credentials, it gets as far as this function, and then seems to go no further.
func segueToConfigurePaypal(sender: UIButton?) {
print("DEBUG Segue to configure paypal")
let scopeValues: Set = [kPayPalOAuth2ScopeOpenId, kPayPalOAuth2ScopeEmail, kPayPalOAuth2ScopeAddress]
let config = PayPalConfiguration()
config.merchantName = "example"
config.merchantPrivacyPolicyURL = URL(string: "http://www.example.com/privacy")
config.merchantUserAgreementURL = URL(string: "http://www.example.com/terms")
let vc = PayPalProfileSharingViewController.init(scopeValues: scopeValues, configuration: config, delegate: self)
self.present(vc!, animated: true, completion: nil)
}
All of which connects to the SDK.
I am wondering if there's a way to make an event listener that will let me know if there's been a problem with the user logging in. This way a user can have some idea about why they're having trouble rather than thinking it is an issue with the app.
Basically I want an alert on user login issues, that reports the issue to the user.

iOS - Firebase dynamic linking with Facebook friends invite issue

I am using firebase dynamic linking to send app invitation using email and sms gateway.
Basically, I am sending the invite code in deep link.
User who's installs with that invite code is connected to my user circle.
Now, I want to send invite code to my Facebook friends. Is there a way to send deep link through Facebook invite.
Following is the code to send the Facebook app invite:
#IBAction func showFacebookInvite(_ sender: AnyObject) {
let content = FBSDKAppInviteContent()
content.appLinkURL = URL(string: "https://fb.meXXXXX")
let obj = FBSDKAppInviteDialog()
obj.content = content
obj.delegate = self
let temp = FBSDKAppInviteDialog.validate(obj)
print(temp)
content.destination = .facebook
FBSDKAppInviteDialog
.show(from: self, with: content, delegate: self)
}
Any suggestions.
You can assign Firebase Dynamic Link to content.appLinkURL . When Facebook friend accepts the invite, friend will navigate to the link and install the App.
This should function identical to email/sms gateway.
To create short FDL links use iOS Builder API https://firebase.google.com/docs/dynamic-links/ios/create

Resources