Capacitor Example

Introduction

This Code example shows how to include the Aerosync widget into your project using the @ionic-native/in-app-browser supported by Capacitor (React) for cross platform development. Securely link your bank account through your bank’s website. Log in with a fast, secure, and tokenized connection. Your information is never shared or sold.

1. Installation

Regular React and Capacitor installation through npm.

2. Usage/Examples

To use the in-app-browser package install it and import it into your react file.

import { InAppBrowser } from '@ionic-native/in-app-browser';

if(token){
      console.log("TOKEN", token)
      // Optional: Add a deeplink parameter to end of URL if you want to use deep linking
      const startUrl = `https://staging.aerosync.com/bank/connect?token=${token}`
      const ref = InAppBrowser.create(startUrl, '_blank', {
        location: 'no',

      });
      // This event will have to capture the oauth? and redirect
      ref.on('loadstart').subscribe((event)=>{
        console.log("Event OnLoad: ", event.url)
        if (event.url.includes('aerosync.com/redirect')) {
          // Append token and launch redirect screen
          var new_url = `${event.url}&token=${token}`
          ref.close()
          const ref2 = InAppBrowser.create(new_url, '_blank', {
            location: 'no',
          });
          console.log("NEW URL REDIRECT: ", new_url)
        }

      })
      ref.on('message').subscribe((event)=>{
        console.log("Message: ", event)
      })
    }