createLiveAuthManager function

Future<AuthManager<OAuthToken>> createLiveAuthManager({
  1. required String username,
  2. required String password,
})

Creates an AuthManager with a current user based on a live Okta user created with createLiveUser.

The manager is also configured to refresh its token when the current user's access token has expired.

Implementation

Future<AuthManager<OAuthToken>> createLiveAuthManager({
  required String username,
  required String password,
}) async {
  final user = await createLiveUser(username: username, password: password);

  final client = FakeAuthClient(
    onEnsureUpdatedToken: (user) =>
        createLiveUser(username: username, password: password),
  );

  final persistence = FakeAuthPersistence(user);

  return AuthManager(client: client, persistence: persistence);
}