Skip to content

Commit

Permalink
update web to programtically include detailed response
Browse files Browse the repository at this point in the history
  • Loading branch information
cwesterhold committed Jul 21, 2022
1 parent 7caf2e7 commit 4443886
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/flutter_auth0_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class FlutterAuth0Client {
final String audience;
final String? scheme;
final bool useEphemeral;
final bool detailedResponse;

FlutterAuth0Client({
required this.clientId,
Expand All @@ -42,6 +43,7 @@ class FlutterAuth0Client {
this.scope = "",
this.audience = "",
this.useEphemeral = false,
this.detailedResponse = false,
});

Future<Auth0Credentials> login() async {
Expand All @@ -54,7 +56,8 @@ class FlutterAuth0Client {
"scope": scope,
"audience": audience,
"useEphemeral": useEphemeral,
"scheme": scheme
"scheme": scheme,
"detailedResponse": detailedResponse,
});
final decodedJson = jsonDecode(rawJson);
return Auth0Credentials.fromJSON(decodedJson);
Expand Down
4 changes: 3 additions & 1 deletion lib/flutter_auth0_client_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ class FlutterAuth0ClientWeb {
scope: args['scope'], audience: args['audience']);
}
final token = await client.getTokenSilently(
detailedResponse: true, audience: args['audience']);
detailedResponse: args['detailedResponse'], audience: args['audience']);
Map<String, dynamic> tokenMap = {
'accessToken': token.accessToken,
'idToken': token.idToken,
'expiresIn': token.expiresIn
};
return jsonEncode(tokenMap);
}


}

0 comments on commit 4443886

Please sign in to comment.