Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Load iOS Configuration #15

Open
sean915213 opened this issue Dec 20, 2022 · 8 comments
Open

Cannot Load iOS Configuration #15

sean915213 opened this issue Dec 20, 2022 · 8 comments

Comments

@sean915213
Copy link

I'm following the latest documents but cannot get past loading the config file to run on an iOS 16.2 simulator. I've placed a file at "ios/Resources/auth_config.json". Then implemented the following code in my main widget:

  @override
  void initState() {
    super.initState();

    // It is possible to register callbacks in order to handle return values
    // from asynchronous calls to the plugin
    AzureB2C.registerCallback(B2COperationSource.INIT, (result) async {
      log('CALLBACK RESULT?: ${result}');
      if (result.reason == B2COperationState.SUCCESS) {
        _configuration = await AzureB2C.getConfiguration();
      }
    });
    log('CALLBACK REGISTERED');

    // Important: Remeber to handle redirect states (if you want to support
    // the web platform with redirect method) and init the AzureB2C plugin
    // before the material app starts.
    _redirectFuture = AzureB2C.handleRedirectFuture().then((_) async { 
      log('INIT START');
      final res = await AzureB2C.init("auth_config");
      log('INITED RES: $res');
      //  _configuration = await AzureB2C.getConfiguration();
      // log('LOADED CONFIG?: $_configuration');
      });
  }

But the INIT callback is never invoked. Furthermore, if I uncomment the last 2 lines in the handleRedirectFuture continuation then the app crashes from a Swift nil reference. So my guess is the loading of the config file simply isn't happening. I've exposed this file as an asset in pubspec.yaml but it doesn't fix anything. Additional info:

  • Flutter: 3.3.10
  • flutter_azure_b2c: 0.0.9
@alex-dokienko
Copy link

hi @sean915213

Did you manage to resolve your issue?
I'm getting similar issue (android working fine), but iOS not
updated info.plist, updated appDelegate.swift, added key chain (com.microsoft.adalcache) but still no luck.
INIT callback doesn't get triggered even with error message.

@sean915213
Copy link
Author

@alex-dokienko I did not. I moved on to another SDK I think. But have since moved on to other projects.

@gpelizzo
Copy link

gpelizzo commented Feb 1, 2024

hi, i'm just stuck because of the same issue. I'm just wondering if someone succeeded to fix or if this plugin is definitely dead.

@alex-dokienko
Copy link

@gpelizzo
plugin probably died, but I managed to make it work for my case, so I found iOS require tfp format for urls, so I did a fork, I don't remember all details now, but you can check what I change in my fork branch
https://github.com/alex-dokienko/flutter_azure_b2c

@gpelizzo
Copy link

gpelizzo commented Feb 3, 2024

@alex-dokienko
Thanks. Unfortunattly, even with your fork, I'm still not able to trigger ININT callback.

@alex-dokienko
Copy link

yeah, it requires different configuration inside app registrations side on b2c portal, it's not the same as for android, you need to use tfp url structure + proper redirect urls, sorry won't be able to give more details.Another thing, debuging plugin on xcode side helped me to understand what is wrong.

@gpelizzo
Copy link

gpelizzo commented Feb 4, 2024

@alex-dokienko thanks again. I give myself a few more hours and then I give up and back to Firebase. I didn't think it would take so long, even more than for the Apple plugin !

@gpelizzo
Copy link

gpelizzo commented Mar 7, 2024

hi, finally I found out ! The config json file was not copy from Resources folder. Adding the file into Xcode Copy Bundle Resources fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants