flutterazureazure-ad-b2c

Retrieving tokens from aad_b2c_webview


I wanted to leverage Microsofts Azure B2C package aad_b2c_webview manage secure login into android app built earlier.

Use case is user lands on login page, after signing into their Azure B2C account, they are able to see the home screen that provides them links to other screens (e.g. profile, dashboard, account) within the android app.

Followed the instructions as per https://github.com/microsoft/aad_b2c_webview

It works, but I am struggling to understand what exactly is happening, and there is almost no viable documentation (its as if Microsoft abandoned this project).

  1. Is it necessary to use deep links? My understanding of deep links is that its primarily used to create seamless xp between web and app, so your users get redirected to app as opposed to website, in my case there is no website so nowhere to host assetlinks.json file (unless i buy a domain, create and host it which seems redudnant). This is only a android app.
  2. I am assuming the meta-data and intent-filter has to be stored within the is this correct?
  3. It mentiones the use of flutter secure storage fore storage and retrieval of access related information (access token, refresh token etc.), how do we access this in subsequent pages to retrieve the relevant tokens?
  4. How does it handle logout mechanism or is this something we have to create using ADB2CEmbedWebView?

Thanks guys.


Solution

  • Note: While deep links are often used for app-to-web redirection, they are not strictly necessary for your use case.

    It mentions the use of flutter secure storage for storage and retrieval of access related information (access token, refresh token etc.), how do we access this in subsequent pages to retrieve the relevant tokens?

    I am assuming the meta-data and intent-filter has to be stored within the is this correct?

    Yes, the meta-data and intent-filter should be stored within the AndroidManifest.xml file to handle the deep link mechanism (if you're using it). This ensures the app knows how to handle incoming URLs. If you're not using deep links, you can skip the deep link-related configurations, but the intent-filter is often still useful to catch specific redirect URIs.

    In an app-only setup, configure the intent-filter in the AndroidManifest.xml to handle the redirect URI, using a custom URI scheme like yourapp://oauth.