Capacitor browser send callback data to Ionic application

263 views Asked by At

I'm implementing an authorization page with a webview in Ionic app that load my website auth page then I want to send some data back to Ionic app with Capacitor browser but I couldn't find any resources on how to do this. I'm using Capacitor 5.

login.ts

import { Browser } from '@capacitor/browser';

openCapacitorSite = async () => {
    await Browser.open({ url: 'https://website.com/login_auth' });
};

This is basically the sample code to open the browser webview and display my site for user to do an authentication, however after authentication, I want to send the data back to my Ionic app, is it possible to do this? After some research, there was someone saying that it doesn't support data callback?

I also found another resource that mentioned that I need to use cordova-plugin-inappbrowser, and tried it:

login.ts

import { Browser } from '@capacitor/browser';

openCapacitorSite = async () => {
    var ref = cordova.InAppBrowser.open('https://website.com/login_auth', '_blank', 'location=yes');
};

but I get this error: 'Cordova/CDVWebViewProcessPoolFactory.h' file not found

0

There are 0 answers