acquireTokenSilent method
Acquire a token silently, with no user interaction, for the given scopes
return UserAdModel
contains user information but token and expiration date
Implementation
Future<UserAdModel?> acquireTokenSilent(
{required List<String> scopes}) async {
var res = <String, dynamic>{'scopes': scopes};
try {
if (Platform.isAndroid) {
await _channel.invokeMethod('loadAccounts');
}
final String json =
await _channel.invokeMethod('acquireTokenSilent', res);
UserAdModel userAdModel = UserAdModel.fromJson(jsonDecode(json));
return await _getUserModel(userAdModel);
} on PlatformException catch (e) {
throw _convertException(e).errorMessage;
}
}