acquireToken method

  1. @override
Future<MsalUser?> acquireToken({
  1. required List<String> scopes,
})
override

Acquire a token interactively for the given scopes return UserAdModel contains user information but token and expiration date

Implementation

@override
Future<MsalUser?> acquireToken({required List<String> scopes}) async {
  return _ErrorHandler.guard<MsalUser?>(() async {
    assert(scopes.isNotEmpty, 'Scopes can not be empty');
    final arguments = <String, dynamic>{'scopes': scopes};
    final json = await methodChannel.invokeMethod('acquireToken', arguments);
    if (json != null) {
      return MsalUser.fromJson(jsonDecode(json));
    }
    return null;
  });
}