Skip to content

Commit

Permalink
Changed acquireTokenSilent to return Account
Browse files Browse the repository at this point in the history
  • Loading branch information
bdrive-ed committed Aug 19, 2021
1 parent 6cc76dc commit ed96b18
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/src/public_client_application.dart
Expand Up @@ -51,7 +51,7 @@ class PublicClientApplication {
}

/// Acquire a token silently, with no user interaction, for the given [scopes]
Future<String> acquireTokenSilent(
Future<Account> acquireTokenSilent(
{required String accountId, required List<String> scopes}) async {
//create the arguments
var res = <String, dynamic>{'accountId': accountId, 'scopes': scopes};
Expand All @@ -61,9 +61,11 @@ class PublicClientApplication {
if (Platform.isAndroid) {
await _channel.invokeMethod('loadAccounts');
}
final String token =
await _channel.invokeMethod('acquireTokenSilent', res);
return token;
final result = await _channel.invokeMethod('acquireTokenSilent', res);
return Account(
accountId: result['accountId'],
accessToken: result['accessToken'],
);
} on PlatformException catch (e) {
throw _convertException(e);
}
Expand Down

0 comments on commit ed96b18

Please sign in to comment.