Skip to content

Commit

Permalink
fix(auth): use loadCredentials to check login state
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan-Nelson committed Sep 20, 2023
1 parent c9634fb commit 2aeded7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,8 @@ final class SignInStateMachine
Future<void> _assertSignedOut() async {
bool isSignedIn;
try {
await manager.getUserPoolTokens();
isSignedIn = true;
final credentials = await manager.loadCredentials();
isSignedIn = credentials.userPoolTokens != null;
} on Exception {
isSignedIn = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ void main() {
).ignore();

final signInStateMachine = stateMachine.expect(SignInStateMachine.type);

final fetchAuthSessionStateMachine = stateMachine.getOrCreate(
FetchAuthSessionStateMachine.type,
);

fetchAuthSessionStateMachine.stream.listen(
(_) => throw StateError('.signIn() should not fetch auth session.'),
);

expect(
signInStateMachine.stream,
emitsInOrder([
Expand Down

0 comments on commit 2aeded7

Please sign in to comment.