acquireTokenSilent method

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

Acquire a token silently, with no user interaction, for the given scopes return UserAdModel contains user information but token and expiration date

Implementation

@override
Future<MsalUser?> acquireTokenSilent({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('acquireTokenSilent', arguments);
    if (json != null) {
      return MsalUser.fromJson(jsonDecode(json));
    }
    return null;
  });
}