Pratik
Pratik

Reputation: 227

App-to-app flow for flutter app with Truelayer

I am trying to implement app-to-app flow from flutter mobile app to the UK bank's app. We are using truelayer. Here is the documentation from truelayer. This GitHub repository contains code from truelayer for sample iOS and Android apps configured for app-to-app redirects to work correctly.

For the flutter app, we are using webview_flutter: ^3.0.4.

It is not redirecting to the bank app, here is the code using webview_flutter package.

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

class WebViewTruelayer extends StatefulWidget {
  const WebViewTruelayer({super.key});

  @override
  WebViewTruelayerState createState() => WebViewTruelayerState();
}

class WebViewTruelayerState extends State<WebViewTruelayer> {
  @override
  void initState() {
    super.initState();
    // Enable virtual display.
    if (Platform.isAndroid) WebView.platform = AndroidWebView();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Trulayer example'),
      ),
      body: WebView(
        javascriptMode: JavascriptMode.unrestricted,
        initialUrl:
            'https://truelayer-sandbox.com/test-redirect',
      ),
    );
  }
}

Result:

Demo

Expected result Source code

Upvotes: 1

Views: 208

Answers (0)

Related Questions