@@ -7,6 +7,8 @@ import 'package:amplify_auth_cognito_dart/src/sdk/cognito_identity_provider.dart
7
7
import 'package:amplify_auth_cognito_dart/src/state/cognito_state_machine.dart' ;
8
8
import 'package:amplify_auth_cognito_dart/src/state/state.dart' ;
9
9
import 'package:amplify_core/amplify_core.dart' ;
10
+ // ignore: implementation_imports
11
+ import 'package:amplify_core/src/config/amplify_outputs/auth/auth_outputs.dart' ;
10
12
11
13
/// {@template amplify_auth_cognito.sign_out_state_machine}
12
14
/// Manages signing out a user and clearing credentials from the local store.
@@ -45,8 +47,14 @@ final class SignOutStateMachine
45
47
/// The Cognito Identity Provider client.
46
48
CognitoIdentityProviderClient get _cognitoIdp => expect ();
47
49
48
- /// The Cognito user pool configuration.
49
- CognitoUserPoolConfig get _userPoolConfig => expect ();
50
+ AuthOutputs get _authOutputs {
51
+ final authOutputs = get <AuthOutputs >();
52
+ if (authOutputs? .userPoolId == null ||
53
+ authOutputs? .userPoolClientId == null ) {
54
+ throw const InvalidAccountTypeException .noUserPool ();
55
+ }
56
+ return authOutputs! ;
57
+ }
50
58
51
59
Future <void > _onInitiate (SignOutInitiate event) async {
52
60
final options = event.options;
@@ -126,8 +134,9 @@ final class SignOutStateMachine
126
134
await _cognitoIdp
127
135
.revokeToken (
128
136
RevokeTokenRequest (
129
- clientId: _userPoolConfig.appClientId,
130
- clientSecret: _userPoolConfig.appClientSecret,
137
+ clientId: _authOutputs.userPoolClientId! ,
138
+ // ignore: invalid_use_of_internal_member
139
+ clientSecret: _authOutputs.appClientSecret,
131
140
token: tokens.refreshToken,
132
141
),
133
142
)
0 commit comments