Account Linking FAQ

This guide provides answers to some commonly asked questions specific to Account Linking.

How does Account Linking handle accounts that require 2FA, CAPTCHA or other authentication challenges?

Sometimes the user’s input is required to successfully log in to a retailer account. This can happen when the user has two-factor authentication enabled, or when the retailer shows a CAPTCHA for extra verification.

In the Retailer Webview Authentication, the SDK will show the webview throughout the entire authentication process. With the legacy Host App Authentication, though, Microblink will handle these extra steps by exposing the webview when we detect these 2FA and CAPTCHAs.

For both verifyRetailer and grabNewOrders, additional authentication is handled in the same way:

  • The BRAccountLinkingError will indicate the stages of this process, which are listed below:
    • BRAccountLinkingErrorVerificationNeeded indicates that the SDK has encountered a page that requires the user’s input. The UIViewController parameter of the callback will be populated with the view controller that you should display.
    • BRAccountLinkingErrorVerificationCompleted indicates that the user successfully authenticated and you should now dismiss the view controller (note that the UIViewController callback parameter will be nil in this case but you do not need it to dismiss a presented modal, simply call, e.g. self.dismiss(animated: false)).

Example:

let taskId = BRAccountLinkingManager.shared().grabNewOrders(for: .walmart) { retailer, order, remaining, viewController, errorCode, sessionID in
  if (errorCode == .verificationNeeded) {
    self.present(viewController, animated: true)
  } else if errorCode == .verificationCompleted {
    self.dismiss(animated: false)
  } else if errorCode == .none {
    // Order may be returned here         
    if (remaining <= 0) {
      // Grab Orders completed successfully
      // No more orders to fetch
    }            
  } else {
    // Grab Orders failed. Check error for more info
  }
}

Can I execute Account Linking from a background thread?

Account Linking is not thread safe so we recommend all execution is done on the main thread.


Linking multiple accounts for the same retailer is not supported. You should unlink the account first before you link a different one for the same retailer.


Can I change a user’s credentials?

Modifying a user’s credentials is not allowed after the BRAccountLinkingConnection object is created. In order for you to change the credentials, you have to unlink the account first and then create and link a new connection with different credentials.

let username = "user 1"
let password = "pass 1"
let connection = BRAccountLinkingConnection(retailer: .walmart, username: username, password: password)
BRAccountLinkingManager.shared().linkRetailer(with: connection)

BRAccountLinkingManager.shared().unlinkAccount(for: .walmart) {
    let conn = BRAccountLinkingConnection(retailer: .walmart, username: "user 2", password: "pass 2")
    conn.configuration.dayCutoff = 30
    BRAccountLinkingManager.shared().linkRetailer(with: conn)
}

Note

It is recommended to call verifyRetailer before linking if unsure whether credentials are valid.


How does Account Linking handle user credentials?

All account credentials are encrypted and stored locally on the device’s keychain. Credentials don’t leave the device and are only used after the retailer session has expired and re-authentication is required.


What happens if grabNewOrders returns success but i don’t see any new orders?

The most common reasons include:

  • Make sure your connection dayCutoff or dateCutoff is large enough to capture your orders. You can verify that by logging in to your retailer account and verifying that you have purchases more recent than your dayCutoff.
  • You haven’t reset orders history. Remember to reset the cache while testing. By default the SDK maintains an internal date of the last successful search for each retailer so that each time you attempt to retrieve new messages, you will only get messages since the last successful check, and subject to the day cutoff that you set (default is 15 days).

You can also reach out to us at blinkreceipt@microblink.com, if you are still not seeing orders after trying the steps above.

Note

Unlinking an account won’t reset the user’s cache if the same user is linked again. To make sure the cache is removed, you must call BRAccountLinkingManager.shared().resetHistory(for: .walmart) for the retailer (in this example, we removed the cache from Walmart).


Yes, Account Linking supports In-Store purchases as long as they are visible in the account.

Note

Target, Walmart, Kroger are just few of the popular merchants that allow their customers to see their In-Store purchases on the web.


What order types are supported?

Account Linking supports the following order types:

  1. In-Store - Purchases made in store.
  2. Delivery - Online purchases that are shipped to the customer.
  3. Pickup - Online purchases that are picked up in store by the customer.
  4. Digital - Movies, eBooks, songs, digital storage, etc.

Does Account Linking return an order status for each of my purchases?

Account Linking returns the following values attached to each purchase: ordered, ready for pickup, shipped, completed, cancelled, refunded, returned. Depending on the retailer and the order type you may see these values populated in one of the following places:

  1. Order status - A status representing the whole order
  2. Shipment status - A status representing a single shipment. Available for Delivery orders only
  3. Product status - A status for a single product.

Is Account Linking going to return a previously fetched order, if its status changes from shipped to delivered?

Account Linking only returns an order once. To get the most recent version of an order you have to re-scrape the order by resetting the order history.

BRAccountLinkingManager.shared().resetHistory(for: .walmart)