From cb3e3e08058826c0d899622c459f842d48a722e9 Mon Sep 17 00:00:00 2001 From: Simon Lightfoot Date: Fri, 17 Jan 2025 19:36:40 +0000 Subject: [PATCH] feat: rename ClerkAuthProvider to ClerkAuthState to clarify its usage (#100) --- .../clerk_auth/lib/src/clerk_auth/auth.dart | 2 +- .../clerk_api/environment_test.dart | 6 +- .../integration/clerk_api/sign_in_test.dart | 26 ++++----- .../integration/clerk_api/sign_up_test.dart | 18 +++--- .../clerk_api/user_details_test.dart | 38 ++++++------- .../integration/clerk_auth/sign_in_test.dart | 34 +++++------ .../integration/clerk_auth/sign_up_test.dart | 26 ++++----- packages/clerk_auth/test/test_helpers.dart | 10 ++-- packages/clerk_flutter/lib/clerk_flutter.dart | 2 +- ...th_provider.dart => clerk_auth_state.dart} | 28 +++++----- .../authentication/clerk_sign_in_panel.dart | 31 +++++----- .../authentication/clerk_sign_out_panel.dart | 6 +- .../authentication/clerk_sign_up_panel.dart | 21 +++---- .../authentication/clerk_sso_panel.dart | 6 +- .../lib/src/widgets/control/clerk_auth.dart | 56 +++++++++---------- .../widgets/control/clerk_auth_builder.dart | 16 +++--- .../widgets/screens/add_account_screen.dart | 20 +++---- .../screens/manage_account_screen.dart | 12 ++-- .../src/widgets/ui/clerk_error_listener.dart | 2 +- .../src/widgets/ui/clerk_input_dialog.dart | 14 ++--- .../src/widgets/user/clerk_user_button.dart | 19 ++++--- .../src/widgets/user/clerk_user_profile.dart | 18 +++--- 22 files changed, 208 insertions(+), 203 deletions(-) rename packages/clerk_flutter/lib/src/{clerk_auth_provider.dart => clerk_auth_state.dart} (90%) diff --git a/packages/clerk_auth/lib/src/clerk_auth/auth.dart b/packages/clerk_auth/lib/src/clerk_auth/auth.dart index cc05648..b6a335d 100644 --- a/packages/clerk_auth/lib/src/clerk_auth/auth.dart +++ b/packages/clerk_auth/lib/src/clerk_auth/auth.dart @@ -95,7 +95,7 @@ class Auth { /// A method to be overridden by extension classes to cope with /// updating their systems when things change (e.g. the clerk_flutter - /// [ClerkAuthProvider] class) + /// ClerkAuth class) /// void update() {} diff --git a/packages/clerk_auth/test/integration/clerk_api/environment_test.dart b/packages/clerk_auth/test/integration/clerk_api/environment_test.dart index 1847fb2..5d44327 100644 --- a/packages/clerk_auth/test/integration/clerk_api/environment_test.dart +++ b/packages/clerk_auth/test/integration/clerk_api/environment_test.dart @@ -7,14 +7,14 @@ import '../../test_helpers.dart'; void main() { late final Api api; late final TestEnv env; - final httpClient = TestHttpClient(); + final httpService = TestHttpService(); setUpAll(() async { env = TestEnv('.env.test'); api = Api( publishableKey: env.publishableKey, persistor: Persistor.none, - httpService: httpClient, + httpService: httpService, ); await setUpLogging(printer: TestLogPrinter(), level: Level.SEVERE); }); @@ -22,7 +22,7 @@ void main() { group('Environment:', () { test('can fetch', () async { await runWithLogging(() async { - httpClient.expect( + httpService.expect( 'GET /v1/environment', 200, '{}', diff --git a/packages/clerk_auth/test/integration/clerk_api/sign_in_test.dart b/packages/clerk_auth/test/integration/clerk_api/sign_in_test.dart index 94f0b11..1a560c6 100644 --- a/packages/clerk_auth/test/integration/clerk_api/sign_in_test.dart +++ b/packages/clerk_auth/test/integration/clerk_api/sign_in_test.dart @@ -9,7 +9,7 @@ import '../../test_helpers.dart'; void main() { late final Api api; late final TestEnv env; - final httpClient = TestHttpClient(); + final httpService = TestHttpService(); final expireAt = DateTime.timestamp() // .add(const Duration(minutes: 5)) .millisecondsSinceEpoch; @@ -19,13 +19,13 @@ void main() { api = Api( publishableKey: env.publishableKey, persistor: Persistor.none, - httpService: httpClient, + httpService: httpService, ); await setUpLogging(printer: TestLogPrinter(), level: Level.SEVERE); }); tearDown(() async { - httpClient.expect('DELETE /v1/client', 200, ''); + httpService.expect('DELETE /v1/client', 200, ''); await api.signOut(); }); @@ -34,12 +34,12 @@ void main() { await runWithLogging(() async { late ApiResponse response; - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins identifier=test1+clerk_test@some.domain', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********01","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":null,"second_factor_verification":null,"identifier":"test1+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732097350149},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********01","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":null,"second_factor_verification":null,"identifier":"test1+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732097350149},"sign_up":null,"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732010950134,"updated_at":1732010950161}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins/SIGN_IN_ATTEMPT_ID/attempt_first_factor strategy=password&password=password', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"complete","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":null,"supported_second_factors":null,"first_factor_verification":{"status":"verified","strategy":"password","attempts":1,"expire_at":null},"second_factor_verification":null,"identifier":"test1+clerk_test@some.domain","USER_ID":null,"created_session_id":"SESSION_ID","abandon_at":1732097350149},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734602950661,"last_active_at":1732010950661,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test1","first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test1+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707000228,"updated_at":1729075139789}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550101","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707000277,"updated_at":1727707000277}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732010950666,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707000164,"updated_at":1732010950691,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731928604966,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"identifier":"test1+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732010950666,"updated_at":1732010950707,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTEwMTAsImlhdCI6MTczMjAxMDk1MCwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDEwOTQwLCJzaWQiOiJzZXNzXzJwNDJJekxoazBsa0ZTMUVodjdGdEpqUjRNdCIsInN1YiI6InVzZXJfMm1uS2ZCazgyWGRnSlhTOW02WEZmWTJMZkdOIn0.zfrvJPrOC9iV4nDjCDut7rhOmio5VMNCgyKUF1th8JF0P02wcwKy4aD0rwWgl-g5eLlRgDsQfE3pqokJwhB4sreGjBbUScMum7LWq77ik65JoxK_xbGmGwjSG6XNGEgJoA1jf6UCgkVtrZsAW-5rVBl9WfEj5hh22n_1zs3PQijoyO1TLRQHP6JrPNhBuipcqHhlhrKtgtxUu89N5zm30fq20e00O6eDdOHn6YbvTKZ6q6u2wfEFUdMUndO-jzOFLE53rDKcCCfoA9nUw9hxEBGBw7liMhMQBOh07nDZI-AybgNyGP7vKcCjrDmiNhugxvsI9tEMH0kRUfb_zmVJ9w"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732010950134,"updated_at":1732010950704}}', @@ -69,17 +69,17 @@ void main() { await runWithLogging(() async { late ApiResponse response; - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins identifier=test2+clerk_test@some.domain', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********02","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test2+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test2+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test2+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":null,"second_factor_verification":null,"identifier":"test2+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732101267634},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********02","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test2+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test2+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test2+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":null,"second_factor_verification":null,"identifier":"test2+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732101267634},"sign_up":null,"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732014867622,"updated_at":1732014867646}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins/SIGN_IN_ATTEMPT_ID/prepare_first_factor strategy=email_code&email_address_id=IDENTIFIER_ID', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********02","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test2+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test2+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test2+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":{"status":"unverified","strategy":"email_code","attempts":0,"expire_at":$expireAt},"second_factor_verification":null,"identifier":"test2+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732101267634},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********02","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test2+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test2+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test2+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":{"status":"unverified","strategy":"email_code","attempts":0,"expire_at":$expireAt},"second_factor_verification":null,"identifier":"test2+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732101267634},"sign_up":null,"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732014867622,"updated_at":1732014868200}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins/SIGN_IN_ATTEMPT_ID/attempt_first_factor strategy=email_code&code=424242', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"complete","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":null,"supported_second_factors":null,"first_factor_verification":{"status":"verified","strategy":"email_code","attempts":1,"expire_at":$expireAt},"second_factor_verification":null,"identifier":"test2+clerk_test@some.domain","USER_ID":null,"created_session_id":"SESSION_ID","abandon_at":1732101267634},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734606868651,"last_active_at":1732014868651,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test2","first_name":"Test2","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktaNGV4aVBwSFk3MzA4WHp6OW1nZkpXTiIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test2+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727706952389,"updated_at":1729075139751}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550102","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727706952398,"updated_at":1727706952398}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732014868661,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727706952371,"updated_at":1732014868701,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731931563814,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Test2","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktaNGV4aVBwSFk3MzA4WHp6OW1nZkpXTiIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"identifier":"test2+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732014868661,"updated_at":1732014868727,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTQ5MjgsImlhdCI6MTczMjAxNDg2OCwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE0ODU4LCJzaWQiOiJzZXNzXzJwNEFGSEZQNVo1bm9HQ2JkdzhqTngyaVIzUSIsInN1YiI6InVzZXJfMm1uS1o0ZXhpUHBIWTczMDhYeno5bWdmSldOIn0.rRG-HVJwLMt4qHO4o-NAvCdNBicD7Pxc16lqxo5sKmTXtWXcfZWSw5diHN7aQ3LlU72c5momdUpS9i6pnN8-t1t9bt3_E4WMQkHb19IqMSjL-mbUwOREY7EsXNPfDFFBKJyWF2yUIicVmA6yL_NS1jcfE-YMm7FeLijAIka8KomWk-aEmEV2_JTuZMn5K4KxJsQpP3BW_9uM0QQqj09a3sxvGEUrcOFbRqarwv1VyrUHwV0kRkkl87VL699lf7L-KNvxc-BlZGuk4dDfebBHU06XlPZEKhhB9zLTDgZMz6Qr2rLRv8_JzNHdZPdkiQbiCeO-9vCfNSF4OCXIYvEJIg"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732014867622,"updated_at":1732014868723}}', @@ -117,12 +117,12 @@ void main() { late ApiResponse response; late SignIn signIn; - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins identifier=test3+clerk_test@some.domain', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********03","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test3+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test3+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test3+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":null,"second_factor_verification":null,"identifier":"test3+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732101346272},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********03","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test3+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test3+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test3+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":null,"second_factor_verification":null,"identifier":"test3+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732101346272},"sign_up":null,"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732014946258,"updated_at":1732014946285}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins/SIGN_IN_ATTEMPT_ID/prepare_first_factor strategy=email_link&email_address_id=IDENTIFIER_ID&redirect_url=https://redirect.to.somewhere', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********03","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test3+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test3+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test3+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":{"status":"unverified","strategy":"email_link","attempts":null,"expire_at":$expireAt},"second_factor_verification":null,"identifier":"test3+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732101346272},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********03","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test3+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test3+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test3+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":{"status":"unverified","strategy":"email_link","attempts":null,"expire_at":$expireAt},"second_factor_verification":null,"identifier":"test3+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732101346272},"sign_up":null,"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732014946258,"updated_at":1732014946680}}', @@ -152,17 +152,17 @@ void main() { late ApiResponse response; late SignIn signIn; - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins identifier=+15555550100', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+15555550100","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"t**************@d********.london","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"t**************@d********.london","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_phone_code","safe_identifier":"+15555550100","phone_number_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":null,"second_factor_verification":null,"identifier":"+15555550100","USER_ID":null,"created_session_id":null,"abandon_at":1732101394921},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+15555550100","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"t**************@d********.london","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"t**************@d********.london","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_phone_code","safe_identifier":"+15555550100","phone_number_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":null,"second_factor_verification":null,"identifier":"+15555550100","USER_ID":null,"created_session_id":null,"abandon_at":1732101394921},"sign_up":null,"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732014994887,"updated_at":1732014994949}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins/SIGN_IN_ATTEMPT_ID/prepare_first_factor strategy=phone_code&phone_number_id=IDENTIFIER_ID', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+15555550100","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"t**************@d********.london","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"t**************@d********.london","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_phone_code","safe_identifier":"+15555550100","phone_number_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":{"status":"unverified","strategy":"phone_code","attempts":0,"expire_at":$expireAt},"second_factor_verification":null,"identifier":"+15555550100","USER_ID":null,"created_session_id":null,"abandon_at":1732101394921},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+15555550100","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"t**************@d********.london","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"t**************@d********.london","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_phone_code","safe_identifier":"+15555550100","phone_number_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":{"status":"unverified","strategy":"phone_code","attempts":0,"expire_at":$expireAt},"second_factor_verification":null,"identifier":"+15555550100","USER_ID":null,"created_session_id":null,"abandon_at":1732101394921},"sign_up":null,"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732014994887,"updated_at":1732014995396}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins/SIGN_IN_ATTEMPT_ID/attempt_first_factor strategy=phone_code&code=424242', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"complete","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":null,"supported_second_factors":null,"first_factor_verification":{"status":"verified","strategy":"phone_code","attempts":1,"expire_at":$expireAt},"second_factor_verification":null,"identifier":"+15555550100","USER_ID":null,"created_session_id":"SESSION_ID","abandon_at":1732101394921},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734606996044,"last_active_at":1732014996044,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"testuser","first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJsS2FxWDVNQ3N5d210M0F5TkJaaklsZWZCaCIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1724931412298,"updated_at":1729070374898}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550100","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1724931412306,"updated_at":1724931412306}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732014996071,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1724931412283,"updated_at":1732014996127,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731940099584,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJsS2FxWDVNQ3N5d210M0F5TkJaaklsZWZCaCIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"identifier":"+15555550100","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732014996071,"updated_at":1732014996155,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTUwNTYsImlhdCI6MTczMjAxNDk5NiwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE0OTg2LCJzaWQiOiJzZXNzXzJwNEFWTU01RnpERG1vYjF6WFpFV0F0Um9UMSIsInN1YiI6InVzZXJfMmxLYXFYNU1Dc3l3bXQzQXlOQlpqSWxlZkJoIn0.lXwxFOBUQo9hl3hs8-wF56NZcni0gCXbgkXF4B33_MN_65cnGNLOWZ6_2aWq6JMLw_lWABuAUyg5RRtncRr8Oz36QVNDoQ9clGwjTHrBtUaOczctd2fR9vuiTbkIaP3_fjKS0XCT3gCM1TMcFHEG5xeu2eCeVFpi9cdBVT-EOn7FuK-rzQT9VXwcuXcqfHBkd38Yri4CbvX202YVUtbeVfyPvfGEVFvoUrI5-PoNqiknJFygIWEEgVcYsCnqrYoL0Qvf6Aoo1v7MAdUUn_3uB6bgesISE4aaVbAQO7ZDppMxuNgdLXavoaCLsw-og27z6CBFkZtF4IO6i7MfKzUnUw"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732014994887,"updated_at":1732014996148}}', diff --git a/packages/clerk_auth/test/integration/clerk_api/sign_up_test.dart b/packages/clerk_auth/test/integration/clerk_api/sign_up_test.dart index 31711f1..ff0ec2d 100644 --- a/packages/clerk_auth/test/integration/clerk_api/sign_up_test.dart +++ b/packages/clerk_auth/test/integration/clerk_api/sign_up_test.dart @@ -14,7 +14,7 @@ import '../../test_helpers.dart'; void main() { late final Api api; late final TestEnv env; - final httpClient = TestHttpClient(); + final httpService = TestHttpService(); final expireAt = DateTime.timestamp() // .add(const Duration(minutes: 5)) .millisecondsSinceEpoch; @@ -36,13 +36,13 @@ void main() { api = Api( publishableKey: env.publishableKey, persistor: Persistor.none, - httpService: httpClient, + httpService: httpService, ); await setUpLogging(printer: TestLogPrinter(), level: Level.SEVERE); }); tearDown(() async { - httpClient.expect('DELETE /v1/me?_clerk_session_id=SESSION_ID', 200, ''); + httpService.expect('DELETE /v1/me?_clerk_session_id=SESSION_ID', 200, ''); await api.deleteUser(); }); @@ -51,17 +51,17 @@ void main() { await runWithLogging(() async { late ApiResponse response; - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ups strategy=email_code&username=user-$password&password=$password&email_address=user-$password+clerk_test@some.domain', 200, '{"response":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["oauth_google","email_address","phone_number","username","last_name","first_name","oauth_apple","oauth_github"],"missing_fields":[],"unverified_fields":["email_address"],"verifications":{"email_address":null,"phone_number":null,"web3_wallet":null,"external_account":null},"username":"user-a8d714a45-cd24-4205-9084-5f1dc5882bdd","email_address":"user-a8d714a45-cd24-4205-9084-5f1dc5882bdd+clerk_test@some.domain","phone_number":null,"web3_wallet":null,"password_enabled":true,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732101514123,"legal_accepted_at":null},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":null,"sign_up":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["oauth_apple","oauth_github","oauth_google","email_address","phone_number","username","last_name","first_name"],"missing_fields":[],"unverified_fields":["email_address"],"verifications":{"email_address":null,"phone_number":null,"web3_wallet":null,"external_account":null},"username":"user-a8d714a45-cd24-4205-9084-5f1dc5882bdd","email_address":"user-a8d714a45-cd24-4205-9084-5f1dc5882bdd+clerk_test@some.domain","phone_number":null,"web3_wallet":null,"password_enabled":true,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732101514123,"legal_accepted_at":null},"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732015114083,"updated_at":1732015114138}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ups/SIGN_UP_ATTEMPT_ID/prepare_verification strategy=email_code', 200, '{"response":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["phone_number","username","first_name","last_name","oauth_apple","oauth_github","oauth_google","email_address"],"missing_fields":[],"unverified_fields":["email_address"],"verifications":{"email_address":{"status":"unverified","strategy":"email_code","attempts":0,"expire_at":$expireAt,"next_action":"needs_attempt","supported_strategies":["email_code"]},"phone_number":null,"web3_wallet":null,"external_account":null},"username":"user-a8d714a45-cd24-4205-9084-5f1dc5882bdd","email_address":"user-a8d714a45-cd24-4205-9084-5f1dc5882bdd+clerk_test@some.domain","phone_number":null,"web3_wallet":null,"password_enabled":true,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732101514123,"legal_accepted_at":null},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":null,"sign_up":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["oauth_github","oauth_google","email_address","phone_number","username","first_name","last_name","oauth_apple"],"missing_fields":[],"unverified_fields":["email_address"],"verifications":{"email_address":{"status":"unverified","strategy":"email_code","attempts":0,"expire_at":$expireAt,"next_action":"needs_attempt","supported_strategies":["email_code"]},"phone_number":null,"web3_wallet":null,"external_account":null},"username":"user-a8d714a45-cd24-4205-9084-5f1dc5882bdd","email_address":"user-a8d714a45-cd24-4205-9084-5f1dc5882bdd+clerk_test@some.domain","phone_number":null,"web3_wallet":null,"password_enabled":true,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732101514123,"legal_accepted_at":null},"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732015114083,"updated_at":1732015114138}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ups/SIGN_UP_ATTEMPT_ID/attempt_verification strategy=email_code&code=424242', 200, '{"response":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"complete","required_fields":["password"],"optional_fields":["oauth_apple","email_address","phone_number","username","first_name","last_name","oauth_github","oauth_google"],"missing_fields":[],"unverified_fields":[],"verifications":{"email_address":{"status":"verified","strategy":"email_code","attempts":1,"expire_at":$expireAt,"next_action":"","supported_strategies":["email_code"]},"phone_number":null,"web3_wallet":null,"external_account":null},"username":"user-a8d714a45-cd24-4205-9084-5f1dc5882bdd","email_address":"user-a8d714a45-cd24-4205-9084-5f1dc5882bdd+clerk_test@some.domain","phone_number":null,"web3_wallet":null,"password_enabled":true,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":"SESSION_ID","created_user_id":"USER_ID","abandon_at":1732101514123,"legal_accepted_at":null},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734607115211,"last_active_at":1732015115211,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"user-a8d714a45-cd24-4205-9084-5f1dc5882bdd","first_name":null,"last_name":null,"image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJwNEFrSHJsYUZyVHEzQUVkYVdTS0R6cmRTWiJ9","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":null,"primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"user-a8d714a45-cd24-4205-9084-5f1dc5882bdd+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"email_code","attempts":1,"expire_at":$expireAt},"linked_to":[],"created_at":1732015114165,"updated_at":1732015115233}],"phone_numbers":[],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732015115213,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1732015115207,"updated_at":1732015115243,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1732015115205,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":null,"last_name":null,"image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJwNEFrSHJsYUZyVHEzQUVkYVdTS0R6cmRTWiJ9","has_image":false,"identifier":"user-a8d714a45-cd24-4205-9084-5f1dc5882bdd+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732015115213,"updated_at":1732015115306,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTUxNzUsImlhdCI6MTczMjAxNTExNSwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE1MTA1LCJzaWQiOiJzZXNzXzJwNEFrTWtIbk1aVVY4c0RpTWxRUHhsSFQzOSIsInN1YiI6InVzZXJfMnA0QWtIcmxhRnJUcTNBRWRhV1NLRHpyZFNaIn0.riumCOE7qL--kuRRDD5HS5O-m95_mXfifTP6Sbp4rZY9kQt-7gSoTLFAZso63GyU3o2gB3JdXilIR0Izl0GdiAnPSxzZspedujfeAb9_CZ9fzaOeIwCHYVM_ptACJLcaVKk8sBPQZlvrhbyfNWQaQikX5i4qb4NE3rpq7gZCqb7bdPgWpCCX_HreJwEtOLmy-7YCWbcxJhLOxn42AwI2qhdTC7QFQGW3muub9G0AZM-KKB99lGllU4EocnP1uxBFwRxrKYRrdlT_SVd44hYipA6ySAms4RfMeXLH53U4DAg30rhSML5svz3BrzoWrMCiSx6g6HoCQv0hL_H4jWZGqA"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732015114083,"updated_at":1732015115301}}', @@ -98,17 +98,17 @@ void main() { await runWithLogging(() async { late ApiResponse response; - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ups strategy=phone_code&username=user-$password&password=$password&phone_number=+15555550109', 200, '{"response":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["email_address","phone_number","username","last_name","first_name","oauth_github","oauth_google","oauth_apple"],"missing_fields":[],"unverified_fields":["phone_number"],"verifications":{"email_address":null,"phone_number":null,"web3_wallet":null,"external_account":null},"username":"user-a4b3f7063-d0f5-4d19-b377-428b0ef73a47","email_address":null,"phone_number":"+15555550109","web3_wallet":null,"password_enabled":true,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732102859167,"legal_accepted_at":null},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":null,"sign_up":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["first_name","last_name","oauth_apple","oauth_github","oauth_google","email_address","phone_number","username"],"missing_fields":[],"unverified_fields":["phone_number"],"verifications":{"email_address":null,"phone_number":null,"web3_wallet":null,"external_account":null},"username":"user-a4b3f7063-d0f5-4d19-b377-428b0ef73a47","email_address":null,"phone_number":"+15555550109","web3_wallet":null,"password_enabled":true,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732102859167,"legal_accepted_at":null},"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732016459154,"updated_at":1732016459186}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ups/SIGN_UP_ATTEMPT_ID/prepare_verification strategy=phone_code', 200, '{"response":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["phone_number","username","last_name","first_name","oauth_apple","oauth_github","oauth_google","email_address"],"missing_fields":[],"unverified_fields":["phone_number"],"verifications":{"email_address":null,"phone_number":{"status":"unverified","strategy":"phone_code","attempts":0,"expire_at":$expireAt,"next_action":"needs_attempt","supported_strategies":["phone_code"]},"web3_wallet":null,"external_account":null},"username":"user-a4b3f7063-d0f5-4d19-b377-428b0ef73a47","email_address":null,"phone_number":"+15555550109","web3_wallet":null,"password_enabled":true,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732102859167,"legal_accepted_at":null},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":null,"sign_up":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["oauth_google","email_address","phone_number","username","last_name","first_name","oauth_apple","oauth_github"],"missing_fields":[],"unverified_fields":["phone_number"],"verifications":{"email_address":null,"phone_number":{"status":"unverified","strategy":"phone_code","attempts":0,"expire_at":$expireAt,"next_action":"needs_attempt","supported_strategies":["phone_code"]},"web3_wallet":null,"external_account":null},"username":"user-a4b3f7063-d0f5-4d19-b377-428b0ef73a47","email_address":null,"phone_number":"+15555550109","web3_wallet":null,"password_enabled":true,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732102859167,"legal_accepted_at":null},"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732016459154,"updated_at":1732016459186}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ups/SIGN_UP_ATTEMPT_ID/attempt_verification strategy=phone_code&code=424242', 200, '{"response":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"complete","required_fields":["password"],"optional_fields":["first_name","last_name","oauth_apple","oauth_github","oauth_google","email_address","phone_number","username"],"missing_fields":[],"unverified_fields":[],"verifications":{"email_address":null,"phone_number":{"status":"verified","strategy":"phone_code","attempts":1,"expire_at":$expireAt,"next_action":"","supported_strategies":["phone_code"]},"web3_wallet":null,"external_account":null},"username":"user-a4b3f7063-d0f5-4d19-b377-428b0ef73a47","email_address":null,"phone_number":"+15555550109","web3_wallet":null,"password_enabled":true,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":"SESSION_ID","created_user_id":"USER_ID","abandon_at":1732102859167,"legal_accepted_at":null},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734608460278,"last_active_at":1732016460278,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"user-a4b3f7063-d0f5-4d19-b377-428b0ef73a47","first_name":null,"last_name":null,"image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJwNERUUGtjZHZjOEkzbnp2S0xhU3lpZ3lXayJ9","has_image":false,"primary_email_address_id":null,"primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550109","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"phone_code","attempts":1,"expire_at":$expireAt},"linked_to":[],"backup_codes":null,"created_at":1732016459198,"updated_at":1732016460309}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732016460286,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1732016460274,"updated_at":1732016460334,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1732016460272,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":null,"last_name":null,"image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJwNERUUGtjZHZjOEkzbnp2S0xhU3lpZ3lXayJ9","has_image":false,"identifier":"+15555550109","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732016460286,"updated_at":1732016460387,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTY1MjAsImlhdCI6MTczMjAxNjQ2MCwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE2NDUwLCJzaWQiOiJzZXNzXzJwNERUSWR0S3VSN3hIQmpicHdBeTRKdzhyVyIsInN1YiI6InVzZXJfMnA0RFRQa2NkdmM4STNuenZLTGFTeWlneVdrIn0.p93MQ1BHOsiUPIFpfJccQs9HLs0-PJWcXmBHEZK17kUvo4bU1Ng9z7Kye3CVYsoNxx_6Gy6xmMouoxFrCQwLSNZKcWflfRWB1MUh6os1rtHeXzm5nLrhto2PFKPFCuHS24SpPUgAJ8VM0ygeKpq2yue5Xdlnq3a8fKh31YClR8VBvtBI5P-JvR8YahlUFQres23DcZkODBDIcDSnSIC2Jm_yiTEk_ruE3oJy-NZWzSIeR5zma94yd1hyF0b1gBvUsJv2wZPgjshJL1NmwU0TGSJTWM1wq_H6YiuXbgC8Z9Heodd513782SBULOoUsKatYuMquWWKKRIFjpf8lrKZSA"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732016459154,"updated_at":1732016460383}}', diff --git a/packages/clerk_auth/test/integration/clerk_api/user_details_test.dart b/packages/clerk_auth/test/integration/clerk_api/user_details_test.dart index 74a6c28..1057b75 100644 --- a/packages/clerk_auth/test/integration/clerk_api/user_details_test.dart +++ b/packages/clerk_auth/test/integration/clerk_api/user_details_test.dart @@ -14,7 +14,7 @@ import '../../test_helpers.dart'; void main() { late final Api api; late final TestEnv env; - final httpClient = TestHttpClient(); + final httpService = TestHttpService(); final expireAt = DateTime.timestamp() // .add(const Duration(minutes: 5)) .millisecondsSinceEpoch; @@ -24,16 +24,16 @@ void main() { api = Api( publishableKey: env.publishableKey, persistor: Persistor.none, - httpService: httpClient, + httpService: httpService, ); await setUpLogging(printer: TestLogPrinter(), level: Level.SEVERE); }); Future signIn(int id) async { - httpClient.expect('DELETE /v1/client', 200, ''); + httpService.expect('DELETE /v1/client', 200, ''); await api.signOut(); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins identifier=test$id+clerk_test@some.domain', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********01","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test$id+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test$id+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test$id+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":null,"second_factor_verification":null,"identifier":"test$id+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732103021570},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********01","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test$id+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test$id+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test$id+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":null,"second_factor_verification":null,"identifier":"test$id+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732103021570},"sign_up":null,"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732016621555,"updated_at":1732016621596}}', @@ -41,7 +41,7 @@ void main() { final response = await api.createSignIn(identifier: 'test$id+clerk_test@some.domain'); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins/SIGN_IN_ATTEMPT_ID/attempt_first_factor strategy=password&password=password', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"complete","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":null,"supported_second_factors":null,"first_factor_verification":{"status":"verified","strategy":"password","attempts":1,"expire_at":null},"second_factor_verification":null,"identifier":"test$id+clerk_test@some.domain","USER_ID":null,"created_session_id":"SESSION_ID","abandon_at":1732103021570},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734608622117,"last_active_at":1732016622117,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test1","first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test$id+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707000228,"updated_at":1729075139789}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550101","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707000277,"updated_at":1727707000277}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732016622125,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707000164,"updated_at":1732016622171,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731928604966,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"identifier":"test$id+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732016622125,"updated_at":1732016622187,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTY2ODIsImlhdCI6MTczMjAxNjYyMiwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE2NjEyLCJzaWQiOiJzZXNzXzJwNERuZjZDamVZMXN0RnB1Z1lQSU52YmJxdCIsInN1YiI6InVzZXJfMm1uS2ZCazgyWGRnSlhTOW02WEZmWTJMZkdOIn0.MvVkZX6QALcyOfK4cIhAoqrVVqlFkiKPSpYSgqdejTOLP_wG-vPahiPRGJMJgYjIQIZiDwU--p-rECXyONN_C1D4aXS6VlQJjw92wfrOavH53Dp3y3XZdOcXFW-6ajDGv6vvZ9CVJUi5kWw4qT3XCqM7UPSnj9ih-fbMOIXRxPUTILVPTqNeJ0tk0hLx1s0rZ0AYBWP-DOmPY5idQV96J7WKGLgjiR-yckNK9_sxg8VFnQyVxGb4YVLrNuU6ZYG6EwGkxXAjGY1xfbPizWyVKSP76XncRtnlFnJVAUTnG7zFUyqP6AH-aZdOZGEMwdF2oAgK3STA7oPO9Y1X5W73CA"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732016621555,"updated_at":1732016622183}}', @@ -55,7 +55,7 @@ void main() { } tearDown(() async { - httpClient.expect('DELETE /v1/client', 200, ''); + httpService.expect('DELETE /v1/client', 200, ''); await api.signOut(); }); @@ -67,27 +67,27 @@ void main() { late ApiResponse response; late User? user; - httpClient.expect( + httpService.expect( 'GET /v1/me?_clerk_session_id=SESSION_ID', 200, '{"response":{"id":"USER_ID","object":"user","username":"test1","first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test1+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707000228,"updated_at":1729075139789}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550101","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707000277,"updated_at":1727707000277}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732016622125,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707000164,"updated_at":1732016622171,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731928604966,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734608622117,"last_active_at":1732016622117,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test1","first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test1+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707000228,"updated_at":1729075139789}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550101","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707000277,"updated_at":1727707000277}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732016622125,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707000164,"updated_at":1732016622171,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731928604966,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"identifier":"test1+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732016622125,"updated_at":1732016622187,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTY2ODIsImlhdCI6MTczMjAxNjYyMiwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE2NjEyLCJzaWQiOiJzZXNzXzJwNERuZjZDamVZMXN0RnB1Z1lQSU52YmJxdCIsInN1YiI6InVzZXJfMm1uS2ZCazgyWGRnSlhTOW02WEZmWTJMZkdOIn0.MvVkZX6QALcyOfK4cIhAoqrVVqlFkiKPSpYSgqdejTOLP_wG-vPahiPRGJMJgYjIQIZiDwU--p-rECXyONN_C1D4aXS6VlQJjw92wfrOavH53Dp3y3XZdOcXFW-6ajDGv6vvZ9CVJUi5kWw4qT3XCqM7UPSnj9ih-fbMOIXRxPUTILVPTqNeJ0tk0hLx1s0rZ0AYBWP-DOmPY5idQV96J7WKGLgjiR-yckNK9_sxg8VFnQyVxGb4YVLrNuU6ZYG6EwGkxXAjGY1xfbPizWyVKSP76XncRtnlFnJVAUTnG7zFUyqP6AH-aZdOZGEMwdF2oAgK3STA7oPO9Y1X5W73CA"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732016621555,"updated_at":1732016622183}}', ); - httpClient.expect( + httpService.expect( 'PATCH /v1/me?_clerk_session_id=SESSION_ID first_name=New&last_name=Cognomen&primary_email_address_id=IDENTIFIER_ID&primary_phone_number_id=IDENTIFIER_ID', 200, '{"response":{"id":"USER_ID","object":"user","username":"test1","first_name":"New","last_name":"Cognomen","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiTkMifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test1+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707000228,"updated_at":1729075139789}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550101","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707000277,"updated_at":1727707000277}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732016622125,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707000164,"updated_at":1732016622763,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731928604966,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734608622117,"last_active_at":1732016622117,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test1","first_name":"New","last_name":"Cognomen","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiTkMifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test1+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707000228,"updated_at":1729075139789}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550101","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707000277,"updated_at":1727707000277}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732016622125,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707000164,"updated_at":1732016622763,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731928604966,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"New","last_name":"Cognomen","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiTkMifQ","has_image":false,"identifier":"test1+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732016622125,"updated_at":1732016622187,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTY2ODIsImlhdCI6MTczMjAxNjYyMiwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE2NjEyLCJzaWQiOiJzZXNzXzJwNERuZjZDamVZMXN0RnB1Z1lQSU52YmJxdCIsInN1YiI6InVzZXJfMm1uS2ZCazgyWGRnSlhTOW02WEZmWTJMZkdOIn0.MvVkZX6QALcyOfK4cIhAoqrVVqlFkiKPSpYSgqdejTOLP_wG-vPahiPRGJMJgYjIQIZiDwU--p-rECXyONN_C1D4aXS6VlQJjw92wfrOavH53Dp3y3XZdOcXFW-6ajDGv6vvZ9CVJUi5kWw4qT3XCqM7UPSnj9ih-fbMOIXRxPUTILVPTqNeJ0tk0hLx1s0rZ0AYBWP-DOmPY5idQV96J7WKGLgjiR-yckNK9_sxg8VFnQyVxGb4YVLrNuU6ZYG6EwGkxXAjGY1xfbPizWyVKSP76XncRtnlFnJVAUTnG7zFUyqP6AH-aZdOZGEMwdF2oAgK3STA7oPO9Y1X5W73CA"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732016621555,"updated_at":1732016622183}}', ); - httpClient.expect( + httpService.expect( 'GET /v1/me?_clerk_session_id=SESSION_ID', 200, '{"response":{"id":"USER_ID","object":"user","username":"test1","first_name":"New","last_name":"Cognomen","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiTkMifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test1+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707000228,"updated_at":1729075139789}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550101","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707000277,"updated_at":1727707000277}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732016622125,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707000164,"updated_at":1732016622763,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731928604966,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734608622117,"last_active_at":1732016622117,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test1","first_name":"New","last_name":"Cognomen","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiTkMifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test1+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707000228,"updated_at":1729075139789}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550101","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707000277,"updated_at":1727707000277}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732016622125,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707000164,"updated_at":1732016622763,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731928604966,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"New","last_name":"Cognomen","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiTkMifQ","has_image":false,"identifier":"test1+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732016622125,"updated_at":1732016622187,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTY2ODMsImlhdCI6MTczMjAxNjYyMywiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE2NjEzLCJzaWQiOiJzZXNzXzJwNERuZjZDamVZMXN0RnB1Z1lQSU52YmJxdCIsInN1YiI6InVzZXJfMm1uS2ZCazgyWGRnSlhTOW02WEZmWTJMZkdOIn0.nwfUsotPCwP0mzpu3a-HR-0d0h5uELQcUc87t2a72pQ17-Vxyg70LH7U0kpLmqpmiPDGEHj2yvXMRllTc_idZsHhPc3P4SXRCKijatap6zKPn8rg6GyTHA2Khpouek2ccR325fot3NxbU-3ApWSWLyq10mx_fV6vs9DKKVBE6U8luaQxqJbfBt-NoU37GSEMm6i5DOmaHwvULFETodd9nclD4WbrGPtxbrzp5nkNWu3YrFM026jwaEBYVY4ULkJyw2vPy8kfvpLSC6InilbooEvVyDxGX4Q8mT-Ew2K5B1zEZDHRawqzalDSFF-QGTfLfp8kM7wR80sVrB-LxglFAQ"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732016621555,"updated_at":1732016622183}}', ); - httpClient.expect( + httpService.expect( 'PATCH /v1/me?_clerk_session_id=SESSION_ID first_name=Test&last_name=User&primary_email_address_id=IDENTIFIER_ID&primary_phone_number_id=IDENTIFIER_ID', 200, '{"response":{"id":"USER_ID","object":"user","username":"test1","first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test1+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707000228,"updated_at":1729075139789}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550101","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707000277,"updated_at":1727707000277}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732016622125,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707000164,"updated_at":1732016623480,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731928604966,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734608622117,"last_active_at":1732016622117,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test1","first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test1+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707000228,"updated_at":1729075139789}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550101","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707000277,"updated_at":1727707000277}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732016622125,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707000164,"updated_at":1732016623480,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731928604966,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"identifier":"test1+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732016622125,"updated_at":1732016622187,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTY2ODMsImlhdCI6MTczMjAxNjYyMywiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE2NjEzLCJzaWQiOiJzZXNzXzJwNERuZjZDamVZMXN0RnB1Z1lQSU52YmJxdCIsInN1YiI6InVzZXJfMm1uS2ZCazgyWGRnSlhTOW02WEZmWTJMZkdOIn0.nwfUsotPCwP0mzpu3a-HR-0d0h5uELQcUc87t2a72pQ17-Vxyg70LH7U0kpLmqpmiPDGEHj2yvXMRllTc_idZsHhPc3P4SXRCKijatap6zKPn8rg6GyTHA2Khpouek2ccR325fot3NxbU-3ApWSWLyq10mx_fV6vs9DKKVBE6U8luaQxqJbfBt-NoU37GSEMm6i5DOmaHwvULFETodd9nclD4WbrGPtxbrzp5nkNWu3YrFM026jwaEBYVY4ULkJyw2vPy8kfvpLSC6InilbooEvVyDxGX4Q8mT-Ew2K5B1zEZDHRawqzalDSFF-QGTfLfp8kM7wR80sVrB-LxglFAQ"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732016621555,"updated_at":1732016622183}}', ); - httpClient.expect( + httpService.expect( 'GET /v1/me?_clerk_session_id=SESSION_ID', 200, '{"response":{"id":"USER_ID","object":"user","username":"test1","first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test1+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707000228,"updated_at":1729075139789}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550101","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707000277,"updated_at":1727707000277}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732016622125,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707000164,"updated_at":1732016623480,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731928604966,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734608622117,"last_active_at":1732016622117,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test1","first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test1+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707000228,"updated_at":1729075139789}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550101","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707000277,"updated_at":1727707000277}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732016622125,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707000164,"updated_at":1732016623480,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731928604966,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"identifier":"test1+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732016622125,"updated_at":1732016622187,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTY2ODMsImlhdCI6MTczMjAxNjYyMywiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE2NjEzLCJzaWQiOiJzZXNzXzJwNERuZjZDamVZMXN0RnB1Z1lQSU52YmJxdCIsInN1YiI6InVzZXJfMm1uS2ZCazgyWGRnSlhTOW02WEZmWTJMZkdOIn0.nwfUsotPCwP0mzpu3a-HR-0d0h5uELQcUc87t2a72pQ17-Vxyg70LH7U0kpLmqpmiPDGEHj2yvXMRllTc_idZsHhPc3P4SXRCKijatap6zKPn8rg6GyTHA2Khpouek2ccR325fot3NxbU-3ApWSWLyq10mx_fV6vs9DKKVBE6U8luaQxqJbfBt-NoU37GSEMm6i5DOmaHwvULFETodd9nclD4WbrGPtxbrzp5nkNWu3YrFM026jwaEBYVY4ULkJyw2vPy8kfvpLSC6InilbooEvVyDxGX4Q8mT-Ew2K5B1zEZDHRawqzalDSFF-QGTfLfp8kM7wR80sVrB-LxglFAQ"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732016621555,"updated_at":1732016622183}}', @@ -125,22 +125,22 @@ void main() { final emailAddress = 'user-${const Uuid().v4()}+clerk_test@some.domain'; - httpClient.expect( + httpService.expect( 'GET /v1/me?_clerk_session_id=SESSION_ID', 200, '{"response":{"id":"USER_ID","object":"user","username":"test2","first_name":"Test2","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktaNGV4aVBwSFk3MzA4WHp6OW1nZkpXTiIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test2+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727706952389,"updated_at":1729075139751}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550102","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727706952398,"updated_at":1727706952398}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732018817799,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727706952371,"updated_at":1732018817848,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731931563814,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734610817790,"last_active_at":1732018817790,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test2","first_name":"Test2","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktaNGV4aVBwSFk3MzA4WHp6OW1nZkpXTiIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test2+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727706952389,"updated_at":1729075139751}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550102","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727706952398,"updated_at":1727706952398}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732018817799,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727706952371,"updated_at":1732018817848,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731931563814,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Test2","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktaNGV4aVBwSFk3MzA4WHp6OW1nZkpXTiIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"identifier":"test2+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732018817799,"updated_at":1732018817863,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTg4NzgsImlhdCI6MTczMjAxODgxOCwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE4ODA4LCJzaWQiOiJzZXNzXzJwNElGWlg3Tk9Jd25aV0htZHZ5V0lsVUN1bCIsInN1YiI6InVzZXJfMm1uS1o0ZXhpUHBIWTczMDhYeno5bWdmSldOIn0.wx96DzzUaD-hwTv4TnJWX30f7ttRDzu9PdGkEz2sHNCC_jF8N7W-fQy6soa0We7aycz1tm3TGJBxdI4qWFfV3ADERRbF1dWBU_UvgV5HT9Jt8TGR1CW1k2a6vw9eX-4a_NbnWbm_ohQv0lY-cLQzTOFsTDoKD991HpJklHC1wVDeVMo_raMMJteNZkF7yoT9ap-_OMBeFi6ZhTTcZGZJ4l8e4g30WrkvLbunpB9h4NcgGXRbhOr3cfVZ7X8T3KfOOjpo7HqbPs24Gn37WyG-Obu4efzmTuzbUj571L52LkR8yVubAJ0F12J9aPjUUMklrSD-f-h5SQEz8PGIDcwgcA"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732018817312,"updated_at":1732018817860}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/me/email_addresses?_clerk_session_id=SESSION_ID email_address=$emailAddress', 200, '{"response":{"id":"IDENTIFIER_ID","object":"email_address","email_address":"$emailAddress","reserved":false,"verification":null,"linked_to":[],"created_at":1732018818573,"updated_at":1732018818573},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734610817790,"last_active_at":1732018817790,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test2","first_name":"Test2","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktaNGV4aVBwSFk3MzA4WHp6OW1nZkpXTiIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"$emailAddress","reserved":false,"verification":null,"linked_to":[],"created_at":1732018818573,"updated_at":1732018818573},{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test2+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727706952389,"updated_at":1729075139751}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550102","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727706952398,"updated_at":1727706952398}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732018817799,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727706952371,"updated_at":1732018817848,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731931563814,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Test2","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktaNGV4aVBwSFk3MzA4WHp6OW1nZkpXTiIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"identifier":"test2+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732018817799,"updated_at":1732018817863,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTg4NzgsImlhdCI6MTczMjAxODgxOCwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE4ODA4LCJzaWQiOiJzZXNzXzJwNElGWlg3Tk9Jd25aV0htZHZ5V0lsVUN1bCIsInN1YiI6InVzZXJfMm1uS1o0ZXhpUHBIWTczMDhYeno5bWdmSldOIn0.wx96DzzUaD-hwTv4TnJWX30f7ttRDzu9PdGkEz2sHNCC_jF8N7W-fQy6soa0We7aycz1tm3TGJBxdI4qWFfV3ADERRbF1dWBU_UvgV5HT9Jt8TGR1CW1k2a6vw9eX-4a_NbnWbm_ohQv0lY-cLQzTOFsTDoKD991HpJklHC1wVDeVMo_raMMJteNZkF7yoT9ap-_OMBeFi6ZhTTcZGZJ4l8e4g30WrkvLbunpB9h4NcgGXRbhOr3cfVZ7X8T3KfOOjpo7HqbPs24Gn37WyG-Obu4efzmTuzbUj571L52LkR8yVubAJ0F12J9aPjUUMklrSD-f-h5SQEz8PGIDcwgcA"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732018817312,"updated_at":1732018817860}}', ); - httpClient.expect( + httpService.expect( 'GET /v1/me?_clerk_session_id=SESSION_ID', 200, '{"response":{"id":"USER_ID","object":"user","username":"test2","first_name":"Test2","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktaNGV4aVBwSFk3MzA4WHp6OW1nZkpXTiIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"$emailAddress","reserved":false,"verification":null,"linked_to":[],"created_at":1732018818573,"updated_at":1732018818573},{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test2+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727706952389,"updated_at":1729075139751}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550102","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727706952398,"updated_at":1727706952398}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732018817799,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727706952371,"updated_at":1732018817848,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731931563814,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734610817790,"last_active_at":1732018817790,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test2","first_name":"Test2","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktaNGV4aVBwSFk3MzA4WHp6OW1nZkpXTiIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"$emailAddress","reserved":false,"verification":null,"linked_to":[],"created_at":1732018818573,"updated_at":1732018818573},{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test2+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727706952389,"updated_at":1729075139751}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550102","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727706952398,"updated_at":1727706952398}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732018817799,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727706952371,"updated_at":1732018817848,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1731931563814,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Test2","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktaNGV4aVBwSFk3MzA4WHp6OW1nZkpXTiIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"identifier":"test2+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732018817799,"updated_at":1732018817863,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTg4NzgsImlhdCI6MTczMjAxODgxOCwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE4ODA4LCJzaWQiOiJzZXNzXzJwNElGWlg3Tk9Jd25aV0htZHZ5V0lsVUN1bCIsInN1YiI6InVzZXJfMm1uS1o0ZXhpUHBIWTczMDhYeno5bWdmSldOIn0.wx96DzzUaD-hwTv4TnJWX30f7ttRDzu9PdGkEz2sHNCC_jF8N7W-fQy6soa0We7aycz1tm3TGJBxdI4qWFfV3ADERRbF1dWBU_UvgV5HT9Jt8TGR1CW1k2a6vw9eX-4a_NbnWbm_ohQv0lY-cLQzTOFsTDoKD991HpJklHC1wVDeVMo_raMMJteNZkF7yoT9ap-_OMBeFi6ZhTTcZGZJ4l8e4g30WrkvLbunpB9h4NcgGXRbhOr3cfVZ7X8T3KfOOjpo7HqbPs24Gn37WyG-Obu4efzmTuzbUj571L52LkR8yVubAJ0F12J9aPjUUMklrSD-f-h5SQEz8PGIDcwgcA"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732018817312,"updated_at":1732018817860}}', ); - httpClient.expect( + httpService.expect( 'DELETE /v1/me/email_addresses/IDENTIFIER_ID?_clerk_session_id=SESSION_ID', 200, '{"response":{"id":"IDENTIFIER_ID","object":"email_address","deleted":true},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734610817790,"last_active_at":1732018817790,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test2","first_name":"Test2","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktaNGV4aVBwSFk3MzA4WHp6OW1nZkpXTiIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test2+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727706952389,"updated_at":1729075139751}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550102","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727706952398,"updated_at":1727706952398}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732018817799,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727706952371,"updated_at":1732018819153,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1732018817874,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Test2","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktaNGV4aVBwSFk3MzA4WHp6OW1nZkpXTiIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"identifier":"test2+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732018817799,"updated_at":1732018817863,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTg4NzksImlhdCI6MTczMjAxODgxOSwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE4ODA5LCJzaWQiOiJzZXNzXzJwNElGWlg3Tk9Jd25aV0htZHZ5V0lsVUN1bCIsInN1YiI6InVzZXJfMm1uS1o0ZXhpUHBIWTczMDhYeno5bWdmSldOIn0.zG_t1LLBv3k96O3boYAg3z4Mmex6dDvVy2ESX7OwMGGqvwPLvANJTlGlK93EU8dBplJrIjmF7db8Ls_1GiDoRUO5AguNB8fa3q3skndC5Vj2VELJeZQavrJ-jUELLhG35cZypwA7s0LOX0w_JnfbtAp4doPgiN28X-PfBr35SfSbAAWhW1UrMdM97MQnIqLPnVy_bngDv22_cx7EH8eu9wDC0pLtPvLHfSrE1YNyyqdxHTJrRR9IbF1h0Oun9fcDUryOGlWwXYzaF-sNVOM_jsFzIpAR9RydKDpqXiuX61R4IRCTeg1Bdm9_9eUZSuo2Ip-m7Fjs_Zk-L8533gB3PA"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732018817312,"updated_at":1732018817860}}', @@ -173,22 +173,22 @@ void main() { late ApiResponse response; late User? user; - httpClient.expect( + httpService.expect( 'GET /v1/me?_clerk_session_id=SESSION_ID', 200, '{"response":{"id":"USER_ID","object":"user","username":"test3","first_name":"Test3","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktqdzlGV1M5VHZxOG4xQWplMWxxZGVlcyIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test3+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707038579,"updated_at":1729075139862}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550103","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707038594,"updated_at":1727707038594}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732019134152,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707038528,"updated_at":1732019134202,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1732019134226,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734611134142,"last_active_at":1732019134142,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test3","first_name":"Test3","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktqdzlGV1M5VHZxOG4xQWplMWxxZGVlcyIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test3+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707038579,"updated_at":1729075139862}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550103","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707038594,"updated_at":1727707038594}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732019134152,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707038528,"updated_at":1732019134202,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1732019134226,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Test3","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktqdzlGV1M5VHZxOG4xQWplMWxxZGVlcyIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"identifier":"test3+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732019134152,"updated_at":1732019134220,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTkxOTQsImlhdCI6MTczMjAxOTEzNCwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE5MTI0LCJzaWQiOiJzZXNzXzJwNEl0UGl5Uno0RWt0M1hnREtWOVNSUUIxZiIsInN1YiI6InVzZXJfMm1uS2p3OUZXUzlUdnE4bjFBamUxbHFkZWVzIn0.WiFuA-8LMCnvxTp7eod5m7k7yLhJlz1LCU-mN0ziJRwn-R_fM6lZere7z-5TM-p5zoHzZoEPowDXKgf94U_VuS2Xp--vFCueVat3-upXWMvoSmn5dwR4PTjfJl-ZYW0zupebbmE9goooICa73F52YD0qGueYI_rcyFCU_NmEAhaPyy7jIW5RU6a9Frin3SLg0P1UcRIs2PeLGNFyeooyMGVgFeKdST8PmHbd0X0gRASFGaSu7LDSWy5kC1PCdM0pINrYnTCr0TUsw6TubgBz7GUmrhMYFkFQ-x4HKasYZuHAU-SR-Fl6K69YsaFkAH57qO8sJLABRph78EsWFokbJg"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732019133645,"updated_at":1732019134214}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/me/phone_numbers?_clerk_session_id=SESSION_ID phone_number=+447700777777', 200, '{"response":{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+447700777777","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":null,"linked_to":[],"backup_codes":null,"created_at":1732019134824,"updated_at":1732019134824},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734611134142,"last_active_at":1732019134142,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test3","first_name":"Test3","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktqdzlGV1M5VHZxOG4xQWplMWxxZGVlcyIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test3+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707038579,"updated_at":1729075139862}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+447700777777","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":null,"linked_to":[],"backup_codes":null,"created_at":1732019134824,"updated_at":1732019134824},{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550103","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707038594,"updated_at":1727707038594}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732019134152,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707038528,"updated_at":1732019134202,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1732019134226,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Test3","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktqdzlGV1M5VHZxOG4xQWplMWxxZGVlcyIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"identifier":"test3+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732019134152,"updated_at":1732019134220,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTkxOTQsImlhdCI6MTczMjAxOTEzNCwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE5MTI0LCJzaWQiOiJzZXNzXzJwNEl0UGl5Uno0RWt0M1hnREtWOVNSUUIxZiIsInN1YiI6InVzZXJfMm1uS2p3OUZXUzlUdnE4bjFBamUxbHFkZWVzIn0.WiFuA-8LMCnvxTp7eod5m7k7yLhJlz1LCU-mN0ziJRwn-R_fM6lZere7z-5TM-p5zoHzZoEPowDXKgf94U_VuS2Xp--vFCueVat3-upXWMvoSmn5dwR4PTjfJl-ZYW0zupebbmE9goooICa73F52YD0qGueYI_rcyFCU_NmEAhaPyy7jIW5RU6a9Frin3SLg0P1UcRIs2PeLGNFyeooyMGVgFeKdST8PmHbd0X0gRASFGaSu7LDSWy5kC1PCdM0pINrYnTCr0TUsw6TubgBz7GUmrhMYFkFQ-x4HKasYZuHAU-SR-Fl6K69YsaFkAH57qO8sJLABRph78EsWFokbJg"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732019133645,"updated_at":1732019134214}}', ); - httpClient.expect( + httpService.expect( 'GET /v1/me?_clerk_session_id=SESSION_ID', 200, '{"response":{"id":"USER_ID","object":"user","username":"test3","first_name":"Test3","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktqdzlGV1M5VHZxOG4xQWplMWxxZGVlcyIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test3+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707038579,"updated_at":1729075139862}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+447700777777","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":null,"linked_to":[],"backup_codes":null,"created_at":1732019134824,"updated_at":1732019134824},{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550103","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707038594,"updated_at":1727707038594}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732019134152,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707038528,"updated_at":1732019134202,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1732019134226,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734611134142,"last_active_at":1732019134142,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test3","first_name":"Test3","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktqdzlGV1M5VHZxOG4xQWplMWxxZGVlcyIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test3+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707038579,"updated_at":1729075139862}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+447700777777","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":null,"linked_to":[],"backup_codes":null,"created_at":1732019134824,"updated_at":1732019134824},{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550103","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707038594,"updated_at":1727707038594}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732019134152,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707038528,"updated_at":1732019134202,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1732019134226,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Test3","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktqdzlGV1M5VHZxOG4xQWplMWxxZGVlcyIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"identifier":"test3+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732019134152,"updated_at":1732019134220,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTkxOTUsImlhdCI6MTczMjAxOTEzNSwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE5MTI1LCJzaWQiOiJzZXNzXzJwNEl0UGl5Uno0RWt0M1hnREtWOVNSUUIxZiIsInN1YiI6InVzZXJfMm1uS2p3OUZXUzlUdnE4bjFBamUxbHFkZWVzIn0.V8Y9L9LDVWEt1oZILVU8PhJ32dmJom-y4Bjm94SiffdO4m3ujp88ThYOO8sLdjcucAQqujG82kZhxSU7zezt445AlyAKGqxheM0VAp1uEVg2TYie71B0XDgieBYG0pTLyS3CoYrWRvOlU4w8aiNnkfMWW0FjLKwWk63p6UsNqaAuYI0BVpG1i-qaE26qMXvLRjmYoESawSQpzhOu67Hj2jsZOEQYuswC_OFYEPKJ45ERDMaPKGyrzoMUypD0zLFgYXtgrtsYmTHU6CrKOG9ZgZ47wI91V-KZyQDKNlf5FPhVVew6bawmH7ancmdjD1N3WZmb_8L1uyPdxZK4uBsqiA"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732019133645,"updated_at":1732019134214}}', ); - httpClient.expect( + httpService.expect( 'DELETE /v1/me/phone_numbers/IDENTIFIER_ID?_clerk_session_id=SESSION_ID', 200, '{"response":{"id":"IDENTIFIER_ID","object":"phone_number","deleted":true},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734611134142,"last_active_at":1732019134142,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test3","first_name":"Test3","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktqdzlGV1M5VHZxOG4xQWplMWxxZGVlcyIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test3+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707038579,"updated_at":1729075139862}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550103","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707038594,"updated_at":1727707038594}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732019134152,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707038528,"updated_at":1732019135407,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1732019134226,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Test3","last_name":"Tester","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktqdzlGV1M5VHZxOG4xQWplMWxxZGVlcyIsImluaXRpYWxzIjoiVFQifQ","has_image":false,"identifier":"test3+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732019134152,"updated_at":1732019134220,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTkxOTUsImlhdCI6MTczMjAxOTEzNSwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE5MTI1LCJzaWQiOiJzZXNzXzJwNEl0UGl5Uno0RWt0M1hnREtWOVNSUUIxZiIsInN1YiI6InVzZXJfMm1uS2p3OUZXUzlUdnE4bjFBamUxbHFkZWVzIn0.V8Y9L9LDVWEt1oZILVU8PhJ32dmJom-y4Bjm94SiffdO4m3ujp88ThYOO8sLdjcucAQqujG82kZhxSU7zezt445AlyAKGqxheM0VAp1uEVg2TYie71B0XDgieBYG0pTLyS3CoYrWRvOlU4w8aiNnkfMWW0FjLKwWk63p6UsNqaAuYI0BVpG1i-qaE26qMXvLRjmYoESawSQpzhOu67Hj2jsZOEQYuswC_OFYEPKJ45ERDMaPKGyrzoMUypD0zLFgYXtgrtsYmTHU6CrKOG9ZgZ47wI91V-KZyQDKNlf5FPhVVew6bawmH7ancmdjD1N3WZmb_8L1uyPdxZK4uBsqiA"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732019133645,"updated_at":1732019134214}}', diff --git a/packages/clerk_auth/test/integration/clerk_auth/sign_in_test.dart b/packages/clerk_auth/test/integration/clerk_auth/sign_in_test.dart index 214213a..73f45bb 100644 --- a/packages/clerk_auth/test/integration/clerk_auth/sign_in_test.dart +++ b/packages/clerk_auth/test/integration/clerk_auth/sign_in_test.dart @@ -7,7 +7,7 @@ import '../../test_helpers.dart'; void main() { late final Auth auth; late final TestEnv env; - final httpClient = TestHttpClient(); + final httpService = TestHttpService(); final expireAt = DateTime.timestamp() // .add(const Duration(minutes: 5)) .millisecondsSinceEpoch; @@ -17,15 +17,15 @@ void main() { auth = Auth( publishableKey: env.publishableKey, persistor: Persistor.none, - httpService: httpClient, + httpService: httpService, ); - httpClient.expect( + httpService.expect( 'POST /v1/client', 200, '{"response":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":null,"sign_up":null,"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732019672385,"updated_at":1732019672391},"client":null}', ); - httpClient.expect( + httpService.expect( 'GET /v1/environment', 200, '{"auth_config":{"object":"auth_config","id":"AUTH_CONFIG_ID","first_name":"on","last_name":"on","email_address":"on","phone_number":"on","username":"on","password":"required","identification_requirements":[["email_address","oauth_apple","oauth_github","oauth_google","oauth_token_apple","phone_number"],["username"]],"identification_strategies":["email_address","oauth_apple","oauth_github","oauth_google","phone_number","username"],"first_factors":["email_code","email_link","google_one_tap","oauth_apple","oauth_github","oauth_google","oauth_token_apple","password","phone_code","reset_password_email_code","reset_password_phone_code","ticket"],"second_factors":["phone_code"],"email_address_verification_strategies":["email_code"],"single_session_mode":false,"enhanced_email_deliverability":false,"test_mode":true,"cookieless_dev":true,"url_based_session_syncing":true,"demo":false},"display_config":{"object":"display_config","id":"DISPLAY_CONFIG_ID","instance_environment_type":"development","application_name":"Flutter SDK Test","theme":{"buttons":{"font_color":"#ffffff","font_family":"\\"Source Sans Pro\\", sans-serif","font_weight":"600"},"general":{"color":"#6c47ff","padding":"1em","box_shadow":"0 2px 8px rgba(0, 0, 0, 0.2)","font_color":"#151515","font_family":"\\"Source Sans Pro\\", sans-serif","border_radius":"0.5em","background_color":"#ffffff","label_font_weight":"600"},"accounts":{"background_color":"#ffffff"}},"preferred_sign_in_strategy":"password","logo_image_url":"https://img.clerk.com/eyJ0eXBlIjoicHJveHkiLCJzcmMiOiJodHRwczovL2ltYWdlcy5jbGVyay5kZXYvdXBsb2FkZWQvaW1nXzJuYzhPMll4aHg1UXdIYU9NTjBrQUhSUmIyTiJ9","favicon_image_url":"","home_url":"https://CLERK-ACCOUNT.accounts.dev/default-redirect","sign_in_url":"https://CLERK-ACCOUNT.accounts.dev/sign-in","sign_up_url":"https://CLERK-ACCOUNT.accounts.dev/sign-up","USER_ID":"https://CLERK-ACCOUNT.accounts.dev/user","waitlist_url":"https://CLERK-ACCOUNT.accounts.dev/waitlist","after_sign_in_url":"https://CLERK-ACCOUNT.accounts.dev/default-redirect","after_sign_up_url":"https://CLERK-ACCOUNT.accounts.dev/default-redirect","after_sign_out_one_url":"https://CLERK-ACCOUNT.accounts.dev/sign-in/choose","after_sign_out_all_url":"https://CLERK-ACCOUNT.accounts.dev/sign-in","after_switch_session_url":"https://CLERK-ACCOUNT.accounts.dev/default-redirect","after_join_waitlist_url":"https://CLERK-ACCOUNT.accounts.dev/default-redirect","organization_profile_url":"https://CLERK-ACCOUNT.accounts.dev/organization","create_organization_url":"https://CLERK-ACCOUNT.accounts.dev/create-organization","after_leave_organization_url":"https://CLERK-ACCOUNT.accounts.dev/default-redirect","after_create_organization_url":"https://CLERK-ACCOUNT.accounts.dev/default-redirect","logo_link_url":"https://CLERK-ACCOUNT.accounts.dev/default-redirect","support_email":null,"branded":true,"experimental_force_oauth_first":false,"clerk_js_version":"5","show_devmode_warning":true,"google_one_tap_client_id":"fake.com","help_url":null,"privacy_policy_url":null,"terms_url":null,"logo_url":"https://images.clerk.dev/uploaded/IMAGE_ID","favicon_url":null,"logo_image":{"object":"image","id":"IMAGE_ID","public_url":"https://images.clerk.dev/uploaded/IMAGE_ID"},"favicon_image":null,"captcha_public_key":null,"captcha_widget_type":null,"captcha_public_key_invisible":null,"captcha_provider":null,"captcha_oauth_bypass":[]},"USER_ID":{"attributes":{"email_address":{"enabled":true,"required":false,"used_for_first_factor":true,"first_factors":["email_code","email_link"],"used_for_second_factor":false,"second_factors":[],"verifications":["email_code"],"verify_at_sign_up":true},"phone_number":{"enabled":true,"required":false,"used_for_first_factor":true,"first_factors":["phone_code"],"used_for_second_factor":true,"second_factors":["phone_code"],"verifications":["phone_code"],"verify_at_sign_up":true},"username":{"enabled":true,"required":false,"used_for_first_factor":true,"first_factors":[],"used_for_second_factor":false,"second_factors":[],"verifications":[],"verify_at_sign_up":false},"web3_wallet":{"enabled":false,"required":false,"used_for_first_factor":false,"first_factors":[],"used_for_second_factor":false,"second_factors":[],"verifications":[],"verify_at_sign_up":false},"first_name":{"enabled":true,"required":false,"used_for_first_factor":false,"first_factors":[],"used_for_second_factor":false,"second_factors":[],"verifications":[],"verify_at_sign_up":false},"last_name":{"enabled":true,"required":false,"used_for_first_factor":false,"first_factors":[],"used_for_second_factor":false,"second_factors":[],"verifications":[],"verify_at_sign_up":false},"password":{"enabled":true,"required":true,"used_for_first_factor":false,"first_factors":[],"used_for_second_factor":false,"second_factors":[],"verifications":[],"verify_at_sign_up":false},"authenticator_app":{"enabled":false,"required":false,"used_for_first_factor":false,"first_factors":[],"used_for_second_factor":false,"second_factors":[],"verifications":[],"verify_at_sign_up":false},"ticket":{"enabled":true,"required":false,"used_for_first_factor":false,"first_factors":[],"used_for_second_factor":false,"second_factors":[],"verifications":[],"verify_at_sign_up":false},"backup_code":{"enabled":false,"required":false,"used_for_first_factor":false,"first_factors":[],"used_for_second_factor":false,"second_factors":[],"verifications":[],"verify_at_sign_up":false},"passkey":{"enabled":false,"required":false,"used_for_first_factor":false,"first_factors":[],"used_for_second_factor":false,"second_factors":[],"verifications":[],"verify_at_sign_up":false}},"sign_in":{"second_factor":{"required":false}},"sign_up":{"captcha_enabled":false,"captcha_widget_type":"smart","custom_action_required":false,"progressive":true,"mode":"public","legal_consent_enabled":false},"restrictions":{"allowlist":{"enabled":false},"blocklist":{"enabled":false},"block_email_subaddresses":{"enabled":false},"block_disposable_email_domains":{"enabled":false},"ignore_dots_for_gmail_addresses":{"enabled":false}},"username_settings":{"min_length":4,"max_length":64},"actions":{"delete_self":true,"create_organization":true,"create_organizations_limit":null},"attack_protection":{"USER_ID":{"enabled":true,"max_attempts":100,"duration_in_minutes":60},"pii":{"enabled":true},"email_link":{"require_same_client":false}},"passkey_settings":{"allow_autofill":true,"show_sign_in_button":true},"social":{"oauth_apple":{"enabled":true,"required":false,"authenticatable":true,"block_email_subaddresses":false,"strategy":"oauth_apple","not_selectable":false,"deprecated":false,"name":"Apple","logo_url":"https://img.clerk.com/static/apple.png"},"oauth_custom_spung":{"enabled":false,"required":false,"authenticatable":true,"block_email_subaddresses":false,"strategy":"oauth_custom_spung","not_selectable":false,"deprecated":false,"name":"spung"},"oauth_github":{"enabled":true,"required":false,"authenticatable":true,"block_email_subaddresses":false,"strategy":"oauth_github","not_selectable":false,"deprecated":false,"name":"GitHub","logo_url":"https://img.clerk.com/static/github.png"},"oauth_google":{"enabled":true,"required":false,"authenticatable":true,"block_email_subaddresses":true,"strategy":"oauth_google","not_selectable":false,"deprecated":false,"name":"Google","logo_url":"https://img.clerk.com/static/google.png"}},"password_settings":{"disable_hibp":false,"min_length":8,"max_length":0,"require_special_char":true,"require_numbers":true,"require_uppercase":true,"require_lowercase":true,"show_zxcvbn":false,"min_zxcvbn_strength":0,"enforce_hibp_on_sign_in":false,"allowed_special_characters":"!\\"#\$%\u0026\'()*+,-./:;\u003c=\u003e?@[]^_`{|}~"},"saml":{"enabled":false},"enterprise_sso":{"enabled":false}},"organization_settings":{"enabled":false,"max_allowed_memberships":5,"actions":{"admin_delete":true},"domains":{"enabled":false,"enrollment_modes":[],"default_role":""},"creator_role":"org:admin"},"maintenance_mode":false}', @@ -37,14 +37,14 @@ void main() { }); tearDown(() async { - httpClient.expect('DELETE /v1/client', 200, ''); + httpService.expect('DELETE /v1/client', 200, ''); await auth.signOut(); }); group('SignIn', () { test('can sign in with password in one step', () async { await runWithLogging(() async { - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins identifier=test1+clerk_test@some.domain&password=password', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"complete","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":null,"supported_second_factors":null,"first_factor_verification":{"status":"verified","strategy":"password","attempts":1,"expire_at":null},"second_factor_verification":null,"identifier":"test1+clerk_test@some.domain","USER_ID":null,"created_session_id":"SESSION_ID","abandon_at":1732106314053},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734611914215,"last_active_at":1732019914215,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test1","first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test1+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707000228,"updated_at":1729075139789}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550101","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707000277,"updated_at":1727707000277}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732019914225,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707000164,"updated_at":1732019914283,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1732016622191,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"identifier":"test1+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732019914225,"updated_at":1732019914327,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMTk5NzQsImlhdCI6MTczMjAxOTkxNCwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE5OTA0LCJzaWQiOiJzZXNzXzJwNEtUUXY5clQxd3FrUVpFMEgwNXZscldVRCIsInN1YiI6InVzZXJfMm1uS2ZCazgyWGRnSlhTOW02WEZmWTJMZkdOIn0.XDBf5movGyGyo7PYaj-QxMiv-M9E86S0RBy0KCNm6W8RGN5kruRXhDayZ0g407N3jw4gqKaepi01JAKCtX6n_yRaKoK5t-k21G4YrgMJKxTT4nyIb-dYkdjAva9VyyQIG9VifuuIRP--5DI4e17h--ClU3PMTiEKAOTiDIEg5ct9fn2-e6e0BzyNk8SDD8M21E63VVkt6F5V593iYjf1qRsttsbgGU93iv_Qc_hIVv9e6_hcqnMpzfFFWg1OmPMwgQA7l6olkDMWFefwcO4enA6FCDV1CoY9OBTNKD1mYnNjVA4RLjx278-2EqOrFpgTMoGSieMEZYWW3cW8BF9iVg"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732019914028,"updated_at":1732019914320}}', @@ -65,17 +65,17 @@ void main() { await runWithLogging(() async { expect(auth.user, null); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins identifier=test1+clerk_test@some.domain', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********01","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":null,"second_factor_verification":null,"identifier":"test1+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732106348550},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********01","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":null,"second_factor_verification":null,"identifier":"test1+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732106348550},"sign_up":null,"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732019948538,"updated_at":1732019948562}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins/SIGN_IN_ATTEMPT_ID/prepare_first_factor strategy=email_code&email_address_id=IDENTIFIER_ID', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********01","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":{"status":"unverified","strategy":"email_code","attempts":0,"expire_at":$expireAt},"second_factor_verification":null,"identifier":"test1+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732106348550},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********01","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":{"status":"unverified","strategy":"email_code","attempts":0,"expire_at":$expireAt},"second_factor_verification":null,"identifier":"test1+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732106348550},"sign_up":null,"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732019948538,"updated_at":1732019948989}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins/SIGN_IN_ATTEMPT_ID/attempt_first_factor strategy=email_code&code=424242', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"complete","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":null,"supported_second_factors":null,"first_factor_verification":{"status":"verified","strategy":"email_code","attempts":1,"expire_at":$expireAt},"second_factor_verification":null,"identifier":"test1+clerk_test@some.domain","USER_ID":null,"created_session_id":"SESSION_ID","abandon_at":1732106348550},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734611949659,"last_active_at":1732019949659,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test1","first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test1+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707000228,"updated_at":1729075139789}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550101","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707000277,"updated_at":1727707000277}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732019949663,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707000164,"updated_at":1732019949686,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1732016622191,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"identifier":"test1+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732019949663,"updated_at":1732019949701,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMjAwMDksImlhdCI6MTczMjAxOTk0OSwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDE5OTM5LCJzaWQiOiJzZXNzXzJwNEtYbzVobzBNNEhSdllZOEtFeUpoZnFqRSIsInN1YiI6InVzZXJfMm1uS2ZCazgyWGRnSlhTOW02WEZmWTJMZkdOIn0.o8NkLdSyMF_Q604xee1YIIFBTW89Gjwv6OPEDcNjALqFBzzYWxTo8dzYCcij_49g6GsiuvEUPefC7Mk6JmSwNDsa3pisCrAQZajWc-sfd42zczTVTH7duMD4Yn9QCc6c6LHTZU0yCPF2GY-oevBQhVE6NjnYVFjUYjMohLAK8NBGKXn5eAtQwMGL39slxIZVuuIyTx3j1FKo65Ndc5ezpQucmkD9K9YjxsakFKeT5h71ElKK0JI8PwN-tQbiJrSpp8OtGaR-AHRPLn9p5wynrPfq5KHIKZUL6Qr66c_QuGOLKSDO5eB0-b0Y22Sd2orpxsOxJ-Z0K4xeW9VL0QIJ7w"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732019948538,"updated_at":1732019949697}}', @@ -95,17 +95,17 @@ void main() { await runWithLogging(() async { expect(auth.user, null); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins identifier=test1+clerk_test@some.domain', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********01","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":null,"second_factor_verification":null,"identifier":"test1+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732106416802},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********01","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":null,"second_factor_verification":null,"identifier":"test1+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732106416802},"sign_up":null,"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732020016788,"updated_at":1732020016811}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins/SIGN_IN_ATTEMPT_ID/prepare_first_factor strategy=phone_code&phone_number_id=IDENTIFIER_ID', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********01","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":{"status":"unverified","strategy":"phone_code","attempts":0,"expire_at":$expireAt},"second_factor_verification":null,"identifier":"test1+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732106416802},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+*********01","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test1+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":{"status":"unverified","strategy":"phone_code","attempts":0,"expire_at":$expireAt},"second_factor_verification":null,"identifier":"test1+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732106416802},"sign_up":null,"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732020016788,"updated_at":1732020017524}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins/SIGN_IN_ATTEMPT_ID/attempt_first_factor strategy=phone_code&code=424242', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"complete","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":null,"supported_second_factors":null,"first_factor_verification":{"status":"verified","strategy":"phone_code","attempts":1,"expire_at":$expireAt},"second_factor_verification":null,"identifier":"test1+clerk_test@some.domain","USER_ID":null,"created_session_id":"SESSION_ID","abandon_at":1732106416802},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734612018086,"last_active_at":1732020018086,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"test1","first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test1+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1727707000228,"updated_at":1729075139789}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550101","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1727707000277,"updated_at":1727707000277}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732020018094,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1727707000164,"updated_at":1732020018124,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1732016622191,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Test","last_name":"User","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJtbktmQms4MlhkZ0pYUzltNlhGZlkyTGZHTiIsImluaXRpYWxzIjoiVFUifQ","has_image":false,"identifier":"test1+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732020018094,"updated_at":1732020018157,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMjAwNzgsImlhdCI6MTczMjAyMDAxOCwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDIwMDA4LCJzaWQiOiJzZXNzXzJwNEtnVkprUjdSWDBvczVBSkFqUUhJNTdVZSIsInN1YiI6InVzZXJfMm1uS2ZCazgyWGRnSlhTOW02WEZmWTJMZkdOIn0.fvNQ7MVKYonJSfQXQZnSHtcLFJRYiTXAMC0JbMlZgqX_Xo8FUspCXrMqGiWSLBzqUcltA6lwsTx6oQAQc1HfqrguWPMdmP-L036ssi8u15Q2-TFJnAtZhy_LAh4J45I3AYnGRJeMezO_cy87R3PmJMLXz7TAKqI8P86hLEHKOWbSOIJTpIzsOS8LqEjB8r7VWuZjFR9OEf4Vu4oWZ69UPVYv_wm76wYbDOi79ECc7O3H86Ap1HNRnmykGR0szpz9tFQE4mJJoMUMvDpZMaInf5OusrjqTNCJhM6cmKiglhR5BLg0oCODi-SMvfXSDRqyNsUyqVgvkbcLuUnL2jT8vQ"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732020016788,"updated_at":1732020018140}}', @@ -125,27 +125,27 @@ void main() { await runWithLogging(() async { expect(auth.user, null); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins identifier=test9+clerk_test@some.domain', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+**********11","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test9+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test9+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test9+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":null,"second_factor_verification":null,"identifier":"test9+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732106734314},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+**********11","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test9+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test9+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test9+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":null,"second_factor_verification":null,"identifier":"test9+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732106734314},"sign_up":null,"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732020334301,"updated_at":1732020334324}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ins/SIGN_IN_ATTEMPT_ID/prepare_first_factor strategy=email_link&email_address_id=IDENTIFIER_ID&redirect_url=https://www.clerk.com', 200, '{"response":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+**********11","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test9+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test9+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test9+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":{"status":"unverified","strategy":"email_link","attempts":null,"expire_at":$expireAt},"second_factor_verification":null,"identifier":"test9+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732106734314},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+**********11","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test9+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test9+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test9+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":{"status":"unverified","strategy":"email_link","attempts":null,"expire_at":$expireAt},"second_factor_verification":null,"identifier":"test9+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732106734314},"sign_up":null,"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732020334301,"updated_at":1732020334683}}', ); - httpClient.expect( + httpService.expect( 'GET /v1/client', 200, '{"response":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+**********11","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test9+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test9+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test9+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":{"status":"unverified","strategy":"email_link","attempts":null,"expire_at":$expireAt},"second_factor_verification":null,"identifier":"test9+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732106734314},"sign_up":null,"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732020334301,"updated_at":1732020334683},"client":null}', ); - httpClient.expect( + httpService.expect( 'GET /v1/client', 200, '{"response":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"needs_first_factor","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":[{"strategy":"password"},{"strategy":"phone_code","safe_identifier":"+**********11","phone_number_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_code","safe_identifier":"test9+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"email_link","safe_identifier":"test9+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true},{"strategy":"reset_password_email_code","safe_identifier":"test9+clerk_test@some.domain","email_address_id":"IDENTIFIER_ID","primary":true}],"supported_second_factors":null,"first_factor_verification":{"status":"unverified","strategy":"email_link","attempts":null,"expire_at":$expireAt},"second_factor_verification":null,"identifier":"test9+clerk_test@some.domain","USER_ID":null,"created_session_id":null,"abandon_at":1732106734314},"sign_up":null,"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732020334301,"updated_at":1732020334683},"client":null}', ); - httpClient.expect( + httpService.expect( 'GET /v1/client', 200, '{"response":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734612361785,"last_active_at":1732020361785,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"shinyford","first_name":"Nic","last_name":"Ford","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJwNExGeFRTUUlJMUhNUkFyNFVMMlhKZmxCWSIsImluaXRpYWxzIjoiTkYifQ","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"test9+clerk_test@some.domain","reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"created_at":1732020300926,"updated_at":1732020300926}],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+447957666211","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"admin","attempts":null,"expire_at":null},"linked_to":[],"backup_codes":null,"created_at":1732020300934,"updated_at":1732020300934}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732020361787,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1732020300910,"updated_at":1732020361803,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":null,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":"Nic","last_name":"Ford","image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJwNExGeFRTUUlJMUhNUkFyNFVMMlhKZmxCWSIsImluaXRpYWxzIjoiTkYifQ","has_image":false,"identifier":"test9+clerk_test@some.domain","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732020361787,"updated_at":1732020361818,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMjA0MjIsImlhdCI6MTczMjAyMDM2MiwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDIwMzUyLCJzaWQiOiJzZXNzXzJwNExOYnUxNm5wTzJMSmNyOWUwaDByNG5IVCIsInN1YiI6InVzZXJfMnA0TEZ4VFNRSUkxSE1SQXI0VUwyWEpmbEJZIn0.hnF7H_r478o--fNokeerGNYX178OKlmBSBnnKOPK5YaUPfK9sp64uVVc3oENyf30LpzDgz88VIoMiRUJI5jTCfWOzxp55n9b0aAl2KQEyeBq5Zzx_w3G6Tt2NVZfiQ0M9V8YRXavaOc0NI0fpOgU-jJRq4QFsGDI_aCeEoNQ1hzGHx3lYR9Hh4D8O1GbV6TnrD-K-KKOWr1Nri-zspDAjj02kPntsjwzVfYCOBkiTR2eTW0YZoMQ7iLnNHfa5BW6QOuDMn6C9Rrm7F46JbQ51A-ZAiB8Hyn9Hr5Y4-JiPzbVpS0AzWNqF1Dw0kCFvFC_CsoNXTdyFit7lf9iK5NneQ"}}],"sign_in":{"object":"sign_in_attempt","id":"SIGN_IN_ATTEMPT_ID","status":"complete","supported_identifiers":["email_address","phone_number","username"],"supported_first_factors":null,"supported_second_factors":null,"first_factor_verification":{"status":"verified","strategy":"email_link","attempts":null,"expire_at":$expireAt,"verified_at_client":"CLIENT_ID"},"second_factor_verification":null,"identifier":"test9+clerk_test@some.domain","USER_ID":null,"created_session_id":"SESSION_ID","abandon_at":1732106734314},"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732020334301,"updated_at":1732020361814},"client":null}', diff --git a/packages/clerk_auth/test/integration/clerk_auth/sign_up_test.dart b/packages/clerk_auth/test/integration/clerk_auth/sign_up_test.dart index 8e1b06d..2507c5e 100644 --- a/packages/clerk_auth/test/integration/clerk_auth/sign_up_test.dart +++ b/packages/clerk_auth/test/integration/clerk_auth/sign_up_test.dart @@ -8,7 +8,7 @@ import '../../test_helpers.dart'; void main() { late final Auth auth; late final TestEnv env; - final httpClient = TestHttpClient(); + final httpService = TestHttpService(); final expireAt = DateTime.timestamp() // .add(const Duration(minutes: 5)) .millisecondsSinceEpoch; @@ -30,15 +30,15 @@ void main() { auth = Auth( publishableKey: env.publishableKey, persistor: Persistor.none, - httpService: httpClient, + httpService: httpService, ); - httpClient.expect( + httpService.expect( 'POST /v1/client', 200, '{"response":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":null,"sign_up":null,"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732019672385,"updated_at":1732019672391},"client":null}', ); - httpClient.expect( + httpService.expect( 'GET /v1/environment', 200, '{"auth_config":{"object":"auth_config","id":"AUTH_CONFIG_ID","first_name":"on","last_name":"on","email_address":"on","phone_number":"on","username":"on","password":"required","identification_requirements":[["email_address","oauth_apple","oauth_github","oauth_google","oauth_token_apple","phone_number"],["username"]],"identification_strategies":["email_address","oauth_apple","oauth_github","oauth_google","phone_number","username"],"first_factors":["email_code","email_link","google_one_tap","oauth_apple","oauth_github","oauth_google","oauth_token_apple","password","phone_code","reset_password_email_code","reset_password_phone_code","ticket"],"second_factors":["phone_code"],"email_address_verification_strategies":["email_code"],"single_session_mode":false,"enhanced_email_deliverability":false,"test_mode":true,"cookieless_dev":true,"url_based_session_syncing":true,"demo":false},"display_config":{"object":"display_config","id":"DISPLAY_CONFIG_ID","instance_environment_type":"development","application_name":"Flutter SDK Test","theme":{"buttons":{"font_color":"#ffffff","font_family":"\\"Source Sans Pro\\", sans-serif","font_weight":"600"},"general":{"color":"#6c47ff","padding":"1em","box_shadow":"0 2px 8px rgba(0, 0, 0, 0.2)","font_color":"#151515","font_family":"\\"Source Sans Pro\\", sans-serif","border_radius":"0.5em","background_color":"#ffffff","label_font_weight":"600"},"accounts":{"background_color":"#ffffff"}},"preferred_sign_in_strategy":"password","logo_image_url":"https://img.clerk.com/eyJ0eXBlIjoicHJveHkiLCJzcmMiOiJodHRwczovL2ltYWdlcy5jbGVyay5kZXYvdXBsb2FkZWQvaW1nXzJuYzhPMll4aHg1UXdIYU9NTjBrQUhSUmIyTiJ9","favicon_image_url":"","home_url":"https://CLERK-ACCOUNT.accounts.dev/default-redirect","sign_in_url":"https://CLERK-ACCOUNT.accounts.dev/sign-in","sign_up_url":"https://CLERK-ACCOUNT.accounts.dev/sign-up","USER_ID":"https://CLERK-ACCOUNT.accounts.dev/user","waitlist_url":"https://CLERK-ACCOUNT.accounts.dev/waitlist","after_sign_in_url":"https://CLERK-ACCOUNT.accounts.dev/default-redirect","after_sign_up_url":"https://CLERK-ACCOUNT.accounts.dev/default-redirect","after_sign_out_one_url":"https://CLERK-ACCOUNT.accounts.dev/sign-in/choose","after_sign_out_all_url":"https://CLERK-ACCOUNT.accounts.dev/sign-in","after_switch_session_url":"https://CLERK-ACCOUNT.accounts.dev/default-redirect","after_join_waitlist_url":"https://CLERK-ACCOUNT.accounts.dev/default-redirect","organization_profile_url":"https://CLERK-ACCOUNT.accounts.dev/organization","create_organization_url":"https://CLERK-ACCOUNT.accounts.dev/create-organization","after_leave_organization_url":"https://CLERK-ACCOUNT.accounts.dev/default-redirect","after_create_organization_url":"https://CLERK-ACCOUNT.accounts.dev/default-redirect","logo_link_url":"https://CLERK-ACCOUNT.accounts.dev/default-redirect","support_email":null,"branded":true,"experimental_force_oauth_first":false,"clerk_js_version":"5","show_devmode_warning":true,"google_one_tap_client_id":"fake.com","help_url":null,"privacy_policy_url":null,"terms_url":null,"logo_url":"https://images.clerk.dev/uploaded/IMAGE_ID","favicon_url":null,"logo_image":{"object":"image","id":"IMAGE_ID","public_url":"https://images.clerk.dev/uploaded/IMAGE_ID"},"favicon_image":null,"captcha_public_key":null,"captcha_widget_type":null,"captcha_public_key_invisible":null,"captcha_provider":null,"captcha_oauth_bypass":[]},"USER_ID":{"attributes":{"email_address":{"enabled":true,"required":false,"used_for_first_factor":true,"first_factors":["email_code","email_link"],"used_for_second_factor":false,"second_factors":[],"verifications":["email_code"],"verify_at_sign_up":true},"phone_number":{"enabled":true,"required":false,"used_for_first_factor":true,"first_factors":["phone_code"],"used_for_second_factor":true,"second_factors":["phone_code"],"verifications":["phone_code"],"verify_at_sign_up":true},"username":{"enabled":true,"required":false,"used_for_first_factor":true,"first_factors":[],"used_for_second_factor":false,"second_factors":[],"verifications":[],"verify_at_sign_up":false},"web3_wallet":{"enabled":false,"required":false,"used_for_first_factor":false,"first_factors":[],"used_for_second_factor":false,"second_factors":[],"verifications":[],"verify_at_sign_up":false},"first_name":{"enabled":true,"required":false,"used_for_first_factor":false,"first_factors":[],"used_for_second_factor":false,"second_factors":[],"verifications":[],"verify_at_sign_up":false},"last_name":{"enabled":true,"required":false,"used_for_first_factor":false,"first_factors":[],"used_for_second_factor":false,"second_factors":[],"verifications":[],"verify_at_sign_up":false},"password":{"enabled":true,"required":true,"used_for_first_factor":false,"first_factors":[],"used_for_second_factor":false,"second_factors":[],"verifications":[],"verify_at_sign_up":false},"authenticator_app":{"enabled":false,"required":false,"used_for_first_factor":false,"first_factors":[],"used_for_second_factor":false,"second_factors":[],"verifications":[],"verify_at_sign_up":false},"ticket":{"enabled":true,"required":false,"used_for_first_factor":false,"first_factors":[],"used_for_second_factor":false,"second_factors":[],"verifications":[],"verify_at_sign_up":false},"backup_code":{"enabled":false,"required":false,"used_for_first_factor":false,"first_factors":[],"used_for_second_factor":false,"second_factors":[],"verifications":[],"verify_at_sign_up":false},"passkey":{"enabled":false,"required":false,"used_for_first_factor":false,"first_factors":[],"used_for_second_factor":false,"second_factors":[],"verifications":[],"verify_at_sign_up":false}},"sign_in":{"second_factor":{"required":false}},"sign_up":{"captcha_enabled":false,"captcha_widget_type":"smart","custom_action_required":false,"progressive":true,"mode":"public","legal_consent_enabled":false},"restrictions":{"allowlist":{"enabled":false},"blocklist":{"enabled":false},"block_email_subaddresses":{"enabled":false},"block_disposable_email_domains":{"enabled":false},"ignore_dots_for_gmail_addresses":{"enabled":false}},"username_settings":{"min_length":4,"max_length":64},"actions":{"delete_self":true,"create_organization":true,"create_organizations_limit":null},"attack_protection":{"USER_ID":{"enabled":true,"max_attempts":100,"duration_in_minutes":60},"pii":{"enabled":true},"email_link":{"require_same_client":false}},"passkey_settings":{"allow_autofill":true,"show_sign_in_button":true},"social":{"oauth_apple":{"enabled":true,"required":false,"authenticatable":true,"block_email_subaddresses":false,"strategy":"oauth_apple","not_selectable":false,"deprecated":false,"name":"Apple","logo_url":"https://img.clerk.com/static/apple.png"},"oauth_custom_spung":{"enabled":false,"required":false,"authenticatable":true,"block_email_subaddresses":false,"strategy":"oauth_custom_spung","not_selectable":false,"deprecated":false,"name":"spung"},"oauth_github":{"enabled":true,"required":false,"authenticatable":true,"block_email_subaddresses":false,"strategy":"oauth_github","not_selectable":false,"deprecated":false,"name":"GitHub","logo_url":"https://img.clerk.com/static/github.png"},"oauth_google":{"enabled":true,"required":false,"authenticatable":true,"block_email_subaddresses":true,"strategy":"oauth_google","not_selectable":false,"deprecated":false,"name":"Google","logo_url":"https://img.clerk.com/static/google.png"}},"password_settings":{"disable_hibp":false,"min_length":8,"max_length":0,"require_special_char":true,"require_numbers":true,"require_uppercase":true,"require_lowercase":true,"show_zxcvbn":false,"min_zxcvbn_strength":0,"enforce_hibp_on_sign_in":false,"allowed_special_characters":"!\\"#\$%\u0026\'()*+,-./:;\u003c=\u003e?@[]^_`{|}~"},"saml":{"enabled":false},"enterprise_sso":{"enabled":false}},"organization_settings":{"enabled":false,"max_allowed_memberships":5,"actions":{"admin_delete":true},"domains":{"enabled":false,"enrollment_modes":[],"default_role":""},"creator_role":"org:admin"},"maintenance_mode":false}', @@ -50,7 +50,7 @@ void main() { }); tearDown(() async { - httpClient.expect('DELETE /v1/client', 200, ''); + httpService.expect('DELETE /v1/client', 200, ''); await auth.signOut(); }); @@ -59,22 +59,22 @@ void main() { await runWithLogging(() async { expect(auth.user, null); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ups strategy=email_code&email_address=$emailAddress', 200, '{"response":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["oauth_github","oauth_google","email_address","phone_number","username","last_name","first_name","oauth_apple"],"missing_fields":["password"],"unverified_fields":["email_address"],"verifications":{"email_address":null,"phone_number":null,"web3_wallet":null,"external_account":null},"username":null,"email_address":"$emailAddress","phone_number":null,"web3_wallet":null,"password_enabled":false,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732107014735,"legal_accepted_at":null},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":null,"sign_up":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["phone_number","username","first_name","last_name","oauth_github","oauth_google","oauth_apple","email_address"],"missing_fields":["password"],"unverified_fields":["email_address"],"verifications":{"email_address":null,"phone_number":null,"web3_wallet":null,"external_account":null},"username":null,"email_address":"$emailAddress","phone_number":null,"web3_wallet":null,"password_enabled":false,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732107014735,"legal_accepted_at":null},"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732020614717,"updated_at":1732020614748}}', ); - httpClient.expect( + httpService.expect( 'PATCH /v1/client/sign_ups/SIGN_UP_ATTEMPT_ID strategy=email_code&email_address=$emailAddress', 200, '{"response":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["oauth_google","email_address","phone_number","username","last_name","first_name","oauth_apple","oauth_github"],"missing_fields":["password"],"unverified_fields":["email_address"],"verifications":{"email_address":null,"phone_number":null,"web3_wallet":null,"external_account":null},"username":null,"email_address":"$emailAddress","phone_number":null,"web3_wallet":null,"password_enabled":false,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732107014735,"legal_accepted_at":null},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":null,"sign_up":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["oauth_google","email_address","phone_number","username","first_name","last_name","oauth_apple","oauth_github"],"missing_fields":["password"],"unverified_fields":["email_address"],"verifications":{"email_address":null,"phone_number":null,"web3_wallet":null,"external_account":null},"username":null,"email_address":"$emailAddress","phone_number":null,"web3_wallet":null,"password_enabled":false,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732107014735,"legal_accepted_at":null},"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732020614717,"updated_at":1732020614748}}', ); - httpClient.expect( + httpService.expect( 'PATCH /v1/client/sign_ups/SIGN_UP_ATTEMPT_ID strategy=email_code&username=user-$password&password=$password', 200, '{"response":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["phone_number","username","first_name","last_name","oauth_apple","oauth_github","oauth_google","email_address"],"missing_fields":[],"unverified_fields":["email_address"],"verifications":{"email_address":{"status":"unverified","strategy":"email_code","attempts":0,"expire_at":$expireAt,"next_action":"needs_attempt","supported_strategies":["email_code"]},"phone_number":null,"web3_wallet":null,"external_account":null},"username":"user-aea093fbf-fe71-4b32-8b31-06d7e3a59c3b","email_address":"$emailAddress","phone_number":null,"web3_wallet":null,"password_enabled":true,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732107014735,"legal_accepted_at":null},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":null,"sign_up":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["oauth_google","email_address","phone_number","username","first_name","last_name","oauth_apple","oauth_github"],"missing_fields":[],"unverified_fields":["email_address"],"verifications":{"email_address":{"status":"unverified","strategy":"email_code","attempts":0,"expire_at":$expireAt,"next_action":"needs_attempt","supported_strategies":["email_code"]},"phone_number":null,"web3_wallet":null,"external_account":null},"username":"user-aea093fbf-fe71-4b32-8b31-06d7e3a59c3b","email_address":"$emailAddress","phone_number":null,"web3_wallet":null,"password_enabled":true,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732107014735,"legal_accepted_at":null},"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732020614717,"updated_at":1732020614748}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ups/SIGN_UP_ATTEMPT_ID/attempt_verification strategy=email_code&code=424242', 200, '{"response":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"complete","required_fields":["password"],"optional_fields":["oauth_apple","oauth_github","oauth_google","email_address","phone_number","username","first_name","last_name"],"missing_fields":[],"unverified_fields":[],"verifications":{"email_address":{"status":"verified","strategy":"email_code","attempts":1,"expire_at":$expireAt,"next_action":"","supported_strategies":["email_code"]},"phone_number":null,"web3_wallet":null,"external_account":null},"username":"user-aea093fbf-fe71-4b32-8b31-06d7e3a59c3b","email_address":"$emailAddress","phone_number":null,"web3_wallet":null,"password_enabled":true,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":"SESSION_ID","created_user_id":"USER_ID","abandon_at":1732107014735,"legal_accepted_at":null},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734612615961,"last_active_at":1732020615961,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"user-aea093fbf-fe71-4b32-8b31-06d7e3a59c3b","first_name":null,"last_name":null,"image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJwNEx0U1JPZmxlM0tuTWIwd2JmN1diRUFzWSJ9","has_image":false,"primary_email_address_id":"IDENTIFIER_ID","primary_phone_number_id":null,"primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"IDENTIFIER_ID","object":"email_address","email_address":"$emailAddress","reserved":false,"verification":{"status":"verified","strategy":"email_code","attempts":1,"expire_at":$expireAt},"linked_to":[],"created_at":1732020615047,"updated_at":1732020615977}],"phone_numbers":[],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732020615963,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1732020615957,"updated_at":1732020615997,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1732020615955,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":null,"last_name":null,"image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJwNEx0U1JPZmxlM0tuTWIwd2JmN1diRUFzWSJ9","has_image":false,"identifier":"$emailAddress","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732020615963,"updated_at":1732020616046,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMjA2NzYsImlhdCI6MTczMjAyMDYxNiwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDIwNjA2LCJzaWQiOiJzZXNzXzJwNEx0WTZ3QWFjcVEwdDFwUG1XWVJQNEN1QyIsInN1YiI6InVzZXJfMnA0THRTUk9mbGUzS25NYjB3YmY3V2JFQXNZIn0.S7UvULOVvBkJ5WqV3I7kU4m_SW_gQak0BP3ouTiDOONf-5tPeiO54bEZ3Ohc3gjHru-BPJ_2Twbd0WzEI3RHCad12pQhQdVwVOosesNn4kI1bCKYdkaL9VgoBCFFoSETANz93dmiNDRdcWRMxUgkviSsqNFFYKZO3wuC1g7nc6n5JvZrVahBuvSn1589M7CPXXer0CCEWi2xXpsYam26mo7QIRbJ1akWJltNkaHStW5WE15ObADecYBXPb0liX7TG9IyT88WVXNPT05EtpBlz4VRnVuiad6ZduhCnr4tN03p2VQ1tpoYqpptKl2DfUmZcEGrtbiRvmDUr9reDpSfeA"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732020614717,"updated_at":1732020616043}}', @@ -110,22 +110,22 @@ void main() { await runWithLogging(() async { expect(auth.user, null); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ups strategy=phone_code&phone_number=+15555550179', 200, '{"response":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["oauth_github","oauth_google","email_address","phone_number","username","first_name","last_name","oauth_apple"],"missing_fields":["password"],"unverified_fields":["phone_number"],"verifications":{"email_address":null,"phone_number":null,"web3_wallet":null,"external_account":null},"username":null,"email_address":null,"phone_number":"+15555550179","web3_wallet":null,"password_enabled":false,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732107138339,"legal_accepted_at":null},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":null,"sign_up":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["oauth_google","email_address","phone_number","username","last_name","first_name","oauth_apple","oauth_github"],"missing_fields":["password"],"unverified_fields":["phone_number"],"verifications":{"email_address":null,"phone_number":null,"web3_wallet":null,"external_account":null},"username":null,"email_address":null,"phone_number":"+15555550179","web3_wallet":null,"password_enabled":false,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732107138339,"legal_accepted_at":null},"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732020738327,"updated_at":1732020738349}}', ); - httpClient.expect( + httpService.expect( 'PATCH /v1/client/sign_ups/SIGN_UP_ATTEMPT_ID strategy=phone_code&phone_number=+15555550179', 200, '{"response":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["first_name","oauth_apple","oauth_github","oauth_google","email_address","phone_number","username","last_name"],"missing_fields":["password"],"unverified_fields":["phone_number"],"verifications":{"email_address":null,"phone_number":null,"web3_wallet":null,"external_account":null},"username":null,"email_address":null,"phone_number":"+15555550179","web3_wallet":null,"password_enabled":false,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732107138339,"legal_accepted_at":null},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":null,"sign_up":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["oauth_google","email_address","phone_number","username","last_name","first_name","oauth_apple","oauth_github"],"missing_fields":["password"],"unverified_fields":["phone_number"],"verifications":{"email_address":null,"phone_number":null,"web3_wallet":null,"external_account":null},"username":null,"email_address":null,"phone_number":"+15555550179","web3_wallet":null,"password_enabled":false,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732107138339,"legal_accepted_at":null},"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732020738327,"updated_at":1732020738349}}', ); - httpClient.expect( + httpService.expect( 'PATCH /v1/client/sign_ups/SIGN_UP_ATTEMPT_ID strategy=phone_code&username=$username&password=$password', 200, '{"response":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["oauth_apple","email_address","phone_number","username","last_name","first_name","oauth_github","oauth_google"],"missing_fields":[],"unverified_fields":["phone_number"],"verifications":{"email_address":null,"phone_number":{"status":"unverified","strategy":"phone_code","attempts":0,"expire_at":$expireAt,"next_action":"needs_attempt","supported_strategies":["phone_code"]},"web3_wallet":null,"external_account":null},"username":"user-a312ee66c-786d-4489-80a5-93e68eb4f98d","email_address":null,"phone_number":"+15555550179","web3_wallet":null,"password_enabled":true,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732107138339,"legal_accepted_at":null},"client":{"object":"client","id":"CLIENT_ID","sessions":[],"sign_in":null,"sign_up":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"missing_requirements","required_fields":["password"],"optional_fields":["username","first_name","last_name","oauth_apple","oauth_github","oauth_google","email_address","phone_number"],"missing_fields":[],"unverified_fields":["phone_number"],"verifications":{"email_address":null,"phone_number":{"status":"unverified","strategy":"phone_code","attempts":0,"expire_at":$expireAt,"next_action":"needs_attempt","supported_strategies":["phone_code"]},"web3_wallet":null,"external_account":null},"username":"user-a312ee66c-786d-4489-80a5-93e68eb4f98d","email_address":null,"phone_number":"+15555550179","web3_wallet":null,"password_enabled":true,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":null,"created_user_id":null,"abandon_at":1732107138339,"legal_accepted_at":null},"last_active_session_id":null,"cookie_expires_at":null,"created_at":1732020738327,"updated_at":1732020738349}}', ); - httpClient.expect( + httpService.expect( 'POST /v1/client/sign_ups/SIGN_UP_ATTEMPT_ID/attempt_verification strategy=phone_code&code=424242', 200, '{"response":{"object":"sign_up_attempt","id":"SIGN_UP_ATTEMPT_ID","status":"complete","required_fields":["password"],"optional_fields":["first_name","last_name","oauth_apple","oauth_github","oauth_google","email_address","phone_number","username"],"missing_fields":[],"unverified_fields":[],"verifications":{"email_address":null,"phone_number":{"status":"verified","strategy":"phone_code","attempts":1,"expire_at":$expireAt,"next_action":"","supported_strategies":["phone_code"]},"web3_wallet":null,"external_account":null},"username":"user-a312ee66c-786d-4489-80a5-93e68eb4f98d","email_address":null,"phone_number":"+15555550179","web3_wallet":null,"password_enabled":true,"first_name":null,"last_name":null,"unsafe_metadata":{},"public_metadata":{},"custom_action":false,"external_id":null,"created_session_id":"SESSION_ID","created_user_id":"USER_ID","abandon_at":1732107138339,"legal_accepted_at":null},"client":{"object":"client","id":"CLIENT_ID","sessions":[{"object":"session","id":"SESSION_ID","status":"active","expire_at":$expireAt,"abandon_at":1734612739655,"last_active_at":1732020739655,"last_active_organization_id":null,"actor":null,"user":{"id":"USER_ID","object":"user","username":"user-a312ee66c-786d-4489-80a5-93e68eb4f98d","first_name":null,"last_name":null,"image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJwNE05NHBzY1BDOHZ2SzcxenVmWVhvR3Y1bCJ9","has_image":false,"primary_email_address_id":null,"primary_phone_number_id":"IDENTIFIER_ID","primary_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_enabled":false,"backup_code_enabled":false,"email_addresses":[],"phone_numbers":[{"id":"IDENTIFIER_ID","object":"phone_number","phone_number":"+15555550179","reserved_for_second_factor":false,"default_second_factor":false,"reserved":false,"verification":{"status":"verified","strategy":"phone_code","attempts":1,"expire_at":$expireAt},"linked_to":[],"backup_codes":null,"created_at":1732020738696,"updated_at":1732020739705}],"web3_wallets":[],"passkeys":[],"external_accounts":[],"saml_accounts":[],"enterprise_accounts":[],"public_metadata":{},"unsafe_metadata":{},"external_id":null,"last_sign_in_at":1732020739656,"banned":false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_remaining":100,"created_at":1732020739650,"updated_at":1732020739722,"delete_self_enabled":true,"create_organization_enabled":true,"last_active_at":1732020739647,"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_image_url":"https://www.gravatar.com/avatar?d=mp","organization_memberships":[]},"public_user_data":{"first_name":null,"last_name":null,"image_url":"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJyaWQiOiJ1c2VyXzJwNE05NHBzY1BDOHZ2SzcxenVmWVhvR3Y1bCJ9","has_image":false,"identifier":"+15555550179","profile_image_url":"https://www.gravatar.com/avatar?d=mp"},"created_at":1732020739656,"updated_at":1732020739786,"last_active_token":{"object":"token","jwt":"eyJhbGciOiJSUzI1NiIsImNhdCI6ImNsX0I3ZDRQRDExMUFBQSIsImtpZCI6Imluc18ya3ZZdzF0WkY4OHNvQjdtN0FYaGlEQ2llMmsiLCJ0eXAiOiJKV1QifQ.eyJleHAiOjE3MzIwMjA3OTksImlhdCI6MTczMjAyMDczOSwiaXNzIjoiaHR0cHM6Ly9tb3JlLXlldGktNTMuY2xlcmsuYWNjb3VudHMuZGV2IiwibmJmIjoxNzMyMDIwNzI5LCJzaWQiOiJzZXNzXzJwNE05OE1XMXhSZ1VMQW13NzB5bGQzdXpuayIsInN1YiI6InVzZXJfMnA0TTk0cHNjUEM4dnZLNzF6dWZZWG9HdjVsIn0.whYxOlCv1t-qWlenxWUQGWl8DB8BhMBivilXKyXJ8dTXOoH2gPfe6KYodKu9fEpLMzxV1AnJ-Gm8VRfB0m6yEvJB7_e9d6T-Cwgj9VyYDN41bZ86-hqzVtznPMWE0FQUiQ6mI4h8u1D82CmbK-CkXwsxpAAx4UoknZHXKdcrgjS-TM9lxSSf7eX-4ubRYbIoiOv7fUf4KjhwO27R0x0EUbhsMN8as3ix0ydfjXxDzX1XCtAdzbHSXPSvmS-hwC1AUH2IN_4P-ssYrj_6wHXTFLThMFH_OXrGj3SV2HmRX6hJeagY3497Tc5TeLhs9w_4fPaRlPqbsTt4OnaKbziQQg"}}],"sign_in":null,"sign_up":null,"last_active_session_id":"SESSION_ID","cookie_expires_at":null,"created_at":1732020738327,"updated_at":1732020739782}}', diff --git a/packages/clerk_auth/test/test_helpers.dart b/packages/clerk_auth/test/test_helpers.dart index ba86853..2872021 100644 --- a/packages/clerk_auth/test/test_helpers.dart +++ b/packages/clerk_auth/test/test_helpers.dart @@ -34,7 +34,7 @@ class TestLogPrinter extends Printer { } } -class TestHttpClient implements HttpService { +class TestHttpService implements HttpService { final _expectations = >{}; @override @@ -51,7 +51,7 @@ class TestHttpClient implements HttpService { final resp = resps.removeAt(0); return Future.value(resp); } - throw TestHttpClientError(message: 'No response available for $key'); + throw TestHttpServiceError(message: 'No response available for $key'); } void expect(String key, int status, String body) { @@ -112,11 +112,11 @@ class TestHttpClient implements HttpService { } } -class TestHttpClientError extends Error { - TestHttpClientError({required this.message}); +class TestHttpServiceError extends Error { + TestHttpServiceError({required this.message}); final String message; @override - String toString() => 'TestHttpClientError: $message'; + String toString() => '$runtimeType: $message'; } diff --git a/packages/clerk_flutter/lib/clerk_flutter.dart b/packages/clerk_flutter/lib/clerk_flutter.dart index e7f6ffa..43e38e6 100644 --- a/packages/clerk_flutter/lib/clerk_flutter.dart +++ b/packages/clerk_flutter/lib/clerk_flutter.dart @@ -1,7 +1,7 @@ /// Package that will allow you to authenticate and use Clerk from Flutter code. library; -export 'src/clerk_auth_provider.dart'; +export 'src/clerk_auth_state.dart'; export 'src/utils/clerk_telemetry.dart'; export 'src/utils/clerk_translator.dart'; export 'src/widgets/authentication/clerk_authentication_widget.dart'; diff --git a/packages/clerk_flutter/lib/src/clerk_auth_provider.dart b/packages/clerk_flutter/lib/src/clerk_auth_state.dart similarity index 90% rename from packages/clerk_flutter/lib/src/clerk_auth_provider.dart rename to packages/clerk_flutter/lib/src/clerk_auth_state.dart index 8cd731c..1f706b4 100644 --- a/packages/clerk_flutter/lib/src/clerk_auth_provider.dart +++ b/packages/clerk_flutter/lib/src/clerk_auth_state.dart @@ -9,9 +9,9 @@ import 'package:webview_flutter/webview_flutter.dart'; /// An extension of [clerk.Auth] with [ChangeNotifier] so that /// updates to the auth state can be propagated out into the UI /// -class ClerkAuthProvider extends clerk.Auth with ChangeNotifier { - /// Construct a [ClerkAuthProvider] - ClerkAuthProvider._({ +class ClerkAuthState extends clerk.Auth with ChangeNotifier { + /// Construct a [ClerkAuthState] + ClerkAuthState._({ required super.publishableKey, required super.persistor, required this.translator, @@ -21,15 +21,15 @@ class ClerkAuthProvider extends clerk.Auth with ChangeNotifier { builder: (context) => loading ?? defaultLoadingWidget, ); - /// Create an [ClerkAuthProvider] object using appropriate Clerk credentials - static Future create({ + /// Create an [ClerkAuthState] object using appropriate Clerk credentials + static Future create({ required String publishableKey, clerk.Persistor? persistor, ClerkTranslator translator = const DefaultClerkTranslator(), clerk.SessionTokenPollMode pollMode = clerk.SessionTokenPollMode.onDemand, Widget? loading, }) async { - final provider = ClerkAuthProvider._( + final provider = ClerkAuthState._( publishableKey: publishableKey, persistor: persistor ?? await clerk.DefaultPersistor.create( @@ -71,10 +71,10 @@ class ClerkAuthProvider extends clerk.Auth with ChangeNotifier { clerk.Strategy strategy, { void Function(clerk.AuthError)? onError, }) async { - final auth = ClerkAuth.of(context, listen: false); + final authState = ClerkAuth.of(context, listen: false); final client = await call( context, - () => auth.oauthSignIn(strategy: strategy), + () => authState.oauthSignIn(strategy: strategy), onError: onError, ); final url = client?.signIn?.firstFactorVerification?.providerUrl; @@ -92,13 +92,13 @@ class ClerkAuthProvider extends clerk.Auth with ChangeNotifier { if (token case String token) { await call( context, - () => auth.attemptSignIn(strategy: strategy, token: token), + () => authState.attemptSignIn(strategy: strategy, token: token), onError: onError, ); } else { - await auth.refreshClient(); + await authState.refreshClient(); if (context.mounted) { - await call(context, () => auth.transfer(), onError: onError); + await call(context, () => authState.transfer(), onError: onError); } } if (context.mounted) { @@ -119,7 +119,7 @@ class ClerkAuthProvider extends clerk.Auth with ChangeNotifier { }) async { T? result; try { - if (context.mounted) { + if (context.mounted && !_loadingOverlay.mounted) { Overlay.of(context).insert(_loadingOverlay); } result = await fn(); @@ -127,7 +127,9 @@ class ClerkAuthProvider extends clerk.Auth with ChangeNotifier { _errors.add(error); onError?.call(error); } finally { - _loadingOverlay.remove(); + if (_loadingOverlay.mounted) { + _loadingOverlay.remove(); + } } return result; } diff --git a/packages/clerk_flutter/lib/src/widgets/authentication/clerk_sign_in_panel.dart b/packages/clerk_flutter/lib/src/widgets/authentication/clerk_sign_in_panel.dart index a1446b4..08764e6 100644 --- a/packages/clerk_flutter/lib/src/widgets/authentication/clerk_sign_in_panel.dart +++ b/packages/clerk_flutter/lib/src/widgets/authentication/clerk_sign_in_panel.dart @@ -34,7 +34,7 @@ class _ClerkSignInPanelState extends State }); } - Future _continue(ClerkAuthProvider auth, + Future _continue(ClerkAuthState authState, {clerk.Strategy? strategy, String? code}) async { if (_hasIdent) { final newStrategy = strategy ?? _strategy; @@ -46,9 +46,9 @@ class _ClerkSignInPanelState extends State }); } - await auth( + await authState( context, - () => auth.attemptSignIn( + () => authState.attemptSignIn( strategy: newStrategy, identifier: _identifier, password: _password.orNullIfEmpty, @@ -61,12 +61,12 @@ class _ClerkSignInPanelState extends State @override Widget build(BuildContext context) { - final auth = ClerkAuth.of(context); - final translator = auth.translator; - final env = auth.env; + final authState = ClerkAuth.of(context); + final translator = authState.translator; + final env = authState.env; final identifiers = env.identificationStrategies .map((i) => i.toString().replaceAll('_', ' ')); - final factor = auth.client.signIn?.supportedFirstFactors + final factor = authState.client.signIn?.supportedFirstFactors .firstWhereOrNull((f) => f.strategy == _strategy); final safeIdentifier = factor?.safeIdentifier; @@ -119,7 +119,7 @@ class _ClerkSignInPanelState extends State ) : translator.translate('Enter the code sent to you'), onSubmit: (code) async { - await _continue(auth, code: code, strategy: _strategy); + await _continue(authState, code: code, strategy: _strategy); return false; }, ), @@ -138,7 +138,7 @@ class _ClerkSignInPanelState extends State obscureText: true, onChanged: (password) => _password = password, onSubmit: (_) => - _continue(auth, strategy: clerk.Strategy.password), + _continue(authState, strategy: clerk.Strategy.password), ), ), if (env.hasOtherStrategies) ...[ @@ -149,19 +149,22 @@ class _ClerkSignInPanelState extends State Padding( padding: topPadding4, child: StrategyButton( - key: ValueKey(strategy), - strategy: strategy, - onClick: () => _continue(auth, strategy: strategy)), + key: ValueKey(strategy), + strategy: strategy, + onClick: () => _continue(authState, strategy: strategy), + ), ), Padding( padding: horizontalPadding32 + bottomPadding32 + topPadding16, child: ClerkMaterialButton( - onPressed: () => _continue(auth), + onPressed: () => _continue(authState), label: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Center(child: Text(translator.translate('Continue'))), + Center( + child: Text(translator.translate('Continue')), + ), horizontalMargin4, const Icon(Icons.arrow_right_sharp), ], diff --git a/packages/clerk_flutter/lib/src/widgets/authentication/clerk_sign_out_panel.dart b/packages/clerk_flutter/lib/src/widgets/authentication/clerk_sign_out_panel.dart index 70b8d30..ebedf42 100644 --- a/packages/clerk_flutter/lib/src/widgets/authentication/clerk_sign_out_panel.dart +++ b/packages/clerk_flutter/lib/src/widgets/authentication/clerk_sign_out_panel.dart @@ -16,12 +16,12 @@ class _ClerkSignOutPanelState extends State with ClerkTelemetryStateMixin { @override Widget build(BuildContext context) { - final auth = ClerkAuth.of(context); + final authState = ClerkAuth.of(context); return Padding( padding: horizontalPadding16, child: ClerkMaterialButton( - onPressed: () => auth.signOut(), - label: Text(auth.translator.translate('Sign Out')), + onPressed: () => authState.signOut(), + label: Text(authState.translator.translate('Sign Out')), ), ); } diff --git a/packages/clerk_flutter/lib/src/widgets/authentication/clerk_sign_up_panel.dart b/packages/clerk_flutter/lib/src/widgets/authentication/clerk_sign_up_panel.dart index 1c6befd..0e8e868 100644 --- a/packages/clerk_flutter/lib/src/widgets/authentication/clerk_sign_up_panel.dart +++ b/packages/clerk_flutter/lib/src/widgets/authentication/clerk_sign_up_panel.dart @@ -26,7 +26,7 @@ class _ClerkSignUpPanelState extends State final _values = {}; bool _obscurePassword = true; - Future _continue(ClerkAuthProvider auth, + Future _continue(ClerkAuthState auth, {String? code, clerk.Strategy? strategy}) async { await auth(context, () async { final password = _values[clerk.UserAttribute.password]; @@ -54,9 +54,9 @@ class _ClerkSignUpPanelState extends State @override Widget build(BuildContext context) { - final auth = ClerkAuth.of(context); - final translator = auth.translator; - final env = auth.env; + final authState = ClerkAuth.of(context); + final translator = authState.translator; + final env = authState.env; final attributes = [ ...env.user.attributes.entries .where((a) => a.value.isEnabled) @@ -68,7 +68,7 @@ class _ClerkSignUpPanelState extends State mainAxisSize: MainAxisSize.min, children: [ Closeable( - closed: auth.signUp?.unverified(clerk.Field.phoneNumber) != true, + closed: authState.signUp?.unverified(clerk.Field.phoneNumber) != true, child: Padding( padding: verticalPadding8, child: ClerkCodeInput( @@ -80,7 +80,7 @@ class _ClerkSignUpPanelState extends State ), onSubmit: (code) async { await _continue( - auth, + authState, strategy: clerk.Strategy.phoneCode, code: code, ); @@ -90,7 +90,8 @@ class _ClerkSignUpPanelState extends State ), ), Closeable( - closed: auth.signUp?.unverified(clerk.Field.emailAddress) != true, + closed: + authState.signUp?.unverified(clerk.Field.emailAddress) != true, child: Padding( padding: verticalPadding8, child: ClerkCodeInput( @@ -101,7 +102,7 @@ class _ClerkSignUpPanelState extends State substitution: _values[clerk.UserAttribute.emailAddress], ), onSubmit: (code) async { - await _continue(auth, + await _continue(authState, strategy: clerk.Strategy.emailCode, code: code); return false; }, @@ -109,7 +110,7 @@ class _ClerkSignUpPanelState extends State ), ), Closeable( - closed: auth.signUp?.unverifiedFields.isNotEmpty == true, + closed: authState.signUp?.unverifiedFields.isNotEmpty == true, child: Column( children: [ for (final attribute in attributes) @@ -140,7 +141,7 @@ class _ClerkSignUpPanelState extends State ), ), ClerkMaterialButton( - onPressed: () => _continue(auth), + onPressed: () => _continue(authState), label: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.stretch, diff --git a/packages/clerk_flutter/lib/src/widgets/authentication/clerk_sso_panel.dart b/packages/clerk_flutter/lib/src/widgets/authentication/clerk_sso_panel.dart index 3763787..7059d42 100644 --- a/packages/clerk_flutter/lib/src/widgets/authentication/clerk_sso_panel.dart +++ b/packages/clerk_flutter/lib/src/widgets/authentication/clerk_sso_panel.dart @@ -24,11 +24,11 @@ class _ClerkSSOPanelState extends State with ClerkTelemetryStateMixin { @override Widget build(BuildContext context) { - final auth = ClerkAuth.of(context); - final oauthStrategies = auth.env.config.identificationStrategies // + final authState = ClerkAuth.of(context); + final oauthStrategies = authState.env.config.identificationStrategies // .where((i) => i.isOauth) .toList(); - final socialConnections = auth.env.user.socialSettings.values // + final socialConnections = authState.env.user.socialSettings.values // .where((s) => oauthStrategies.contains(s.strategy)) .toList(); diff --git a/packages/clerk_flutter/lib/src/widgets/control/clerk_auth.dart b/packages/clerk_flutter/lib/src/widgets/control/clerk_auth.dart index 29dcf7f..2d3ad52 100644 --- a/packages/clerk_flutter/lib/src/widgets/control/clerk_auth.dart +++ b/packages/clerk_flutter/lib/src/widgets/control/clerk_auth.dart @@ -11,14 +11,14 @@ class ClerkAuth extends StatefulWidget { super.key, this.publishableKey, this.pollMode = clerk.SessionTokenPollMode.onDemand, - this.auth, + this.authState, this.translator = const DefaultClerkTranslator(), this.persistor, this.loading, required this.child, }) : assert( - (publishableKey is String) != (auth is ClerkAuthProvider), - 'Either publishableKey or an auth instance must ' + (publishableKey is String) != (authState is ClerkAuthState), + 'Either [publishableKey] or an [authState] instance must ' 'be provided, but not both', ); @@ -26,7 +26,7 @@ class ClerkAuth extends StatefulWidget { final String? publishableKey; /// auth instance from elsewhere - final ClerkAuthProvider? auth; + final ClerkAuthState? authState; /// Persistence service for caching tokens final clerk.Persistor? persistor; @@ -46,14 +46,14 @@ class ClerkAuth extends StatefulWidget { @override State createState() => _ClerkAuthState(); - /// Get the [context]'s nearest [ClerkAuthProvider] + /// Get the [context]'s nearest [ClerkAuthState] /// with rebuild on change - static ClerkAuthProvider of(BuildContext context, {bool listen = true}) { + static ClerkAuthState of(BuildContext context, {bool listen = true}) { final result = listen // ? context.dependOnInheritedWidgetOfExactType<_ClerkAuthData>() : context.findAncestorWidgetOfExactType<_ClerkAuthData>(); - assert(result != null, 'No `ClerkAuthProvider` found in context'); - return result!.auth; + assert(result != null, 'No `ClerkAuth` found in context'); + return result!.authState; } /// Get the most recent [clerk.User] object @@ -62,13 +62,13 @@ class ClerkAuth extends StatefulWidget { /// Get the most recent [clerk.Session] object static clerk.Session? sessionOf(BuildContext context) => of(context).session; - /// Get the [context]'s nearest [ClerkAuthProvider] + /// Get the [context]'s nearest [ClerkAuthState] /// without rebuild on change @Deprecated('Use .of() instead with listen = false') - static ClerkAuthProvider above(BuildContext context) { + static ClerkAuthState above(BuildContext context) { final result = context.findAncestorWidgetOfExactType<_ClerkAuthData>(); - assert(result != null, 'No `ClerkAuthProvider` found in context'); - return result!.auth; + assert(result != null, 'No `ClerkAuth` found in context'); + return result!.authState; } /// Get the [ClerkTranslator] @@ -79,37 +79,37 @@ class ClerkAuth extends StatefulWidget { static clerk.DisplayConfig displayConfigOf(BuildContext context) => of(context, listen: false).env.display; - /// get the stream of [ClerkAuthProviderError] + /// get the stream of [clerk.AuthError] static Stream errorStreamOf(BuildContext context) => of(context, listen: false).errorStream; } class _ClerkAuthState extends State with ClerkTelemetryStateMixin { - ClerkAuthProvider? _clerkAuth; + ClerkAuthState? _clerkAuthState; - ClerkAuthProvider? get effectiveAuth => widget.auth ?? _clerkAuth; + ClerkAuthState? get effectiveAuthState => widget.authState ?? _clerkAuthState; @override Map get telemetryPayload { return { 'poll_mode': widget.pollMode.toString(), - 'primary_instance': widget.auth == null, + 'primary_instance': widget.authState == null, }; } @override void initState() { super.initState(); - if (widget.auth == null) { - ClerkAuthProvider.create( + if (widget.authState == null) { + ClerkAuthState.create( publishableKey: widget.publishableKey!, persistor: widget.persistor, translator: widget.translator, loading: widget.loading, pollMode: widget.pollMode, - ).then((auth) { + ).then((authState) { if (mounted) { - setState(() => _clerkAuth = auth); + setState(() => _clerkAuthState = authState); } }); } @@ -118,17 +118,17 @@ class _ClerkAuthState extends State with ClerkTelemetryStateMixin { @override void dispose() { super.dispose(); - _clerkAuth?.terminate(); + _clerkAuthState?.terminate(); } @override Widget build(BuildContext context) { - if (effectiveAuth case ClerkAuthProvider auth) { + if (effectiveAuthState case ClerkAuthState authState) { return ListenableBuilder( - listenable: auth, + listenable: authState, builder: (BuildContext context, Widget? child) { return _ClerkAuthData( - auth: auth, + authState: authState, child: widget.child, ); }, @@ -142,13 +142,13 @@ class _ClerkAuthState extends State with ClerkTelemetryStateMixin { /// Data class holding the auth object class _ClerkAuthData extends InheritedWidget { _ClerkAuthData({ - required this.auth, + required this.authState, required super.child, - }) : client = auth.client, - env = auth.env; + }) : client = authState.client, + env = authState.env; /// Clerk auth object - final ClerkAuthProvider auth; + final ClerkAuthState authState; final clerk.Client client; final clerk.Environment env; diff --git a/packages/clerk_flutter/lib/src/widgets/control/clerk_auth_builder.dart b/packages/clerk_flutter/lib/src/widgets/control/clerk_auth_builder.dart index a712355..c6a7996 100644 --- a/packages/clerk_flutter/lib/src/widgets/control/clerk_auth_builder.dart +++ b/packages/clerk_flutter/lib/src/widgets/control/clerk_auth_builder.dart @@ -4,11 +4,9 @@ import 'package:flutter/material.dart'; /// Typedef for builder invoked by [ClerkAuthBuilder] typedef AuthWidgetBuilder = Widget Function( - BuildContext context, - ClerkAuthProvider auth, -); + BuildContext context, ClerkAuthState authState); -/// A [Widget] which builds its subtree in the context of a [ClerkAuthProvider] +/// A [Widget] which builds its subtree in the context of a [ClerkAuthState] /// /// the [signedInBuilder] will be invoked when a [clerk.User] is available /// the [signedOutBuilder] will be invoked when a [clerk.User] is not available @@ -50,19 +48,19 @@ class _ClerkAuthBuilderState extends State @override Widget build(BuildContext context) { - final auth = ClerkAuth.of(context); - final user = auth.client.user; + final authState = ClerkAuth.of(context); + final user = authState.client.user; if (widget.signedInBuilder case AuthWidgetBuilder signedInBuilder when user is clerk.User) { - return signedInBuilder(context, auth); + return signedInBuilder(context, authState); } if (widget.signedOutBuilder case AuthWidgetBuilder signedOutBuilder when user is! clerk.User) { - return signedOutBuilder(context, auth); + return signedOutBuilder(context, authState); } - return widget.builder?.call(context, auth) ?? emptyWidget; + return widget.builder?.call(context, authState) ?? emptyWidget; } } diff --git a/packages/clerk_flutter/lib/src/widgets/screens/add_account_screen.dart b/packages/clerk_flutter/lib/src/widgets/screens/add_account_screen.dart index ba06d24..aabeb5d 100644 --- a/packages/clerk_flutter/lib/src/widgets/screens/add_account_screen.dart +++ b/packages/clerk_flutter/lib/src/widgets/screens/add_account_screen.dart @@ -6,24 +6,24 @@ import 'package:flutter/material.dart'; /// class AddAccountScreen extends StatefulWidget { const AddAccountScreen._({ - required this.auth, + required this.authState, }); - /// An injected [ClerkAuthProvider] - final ClerkAuthProvider auth; + /// An injected [ClerkAuthState] + final ClerkAuthState authState; /// The name of the route to this screen static const routeName = 'clerk_add_account'; /// static method to show an [AddAccountScreen] static Future show(BuildContext context) async { - final auth = ClerkAuth.of(context, listen: false); + final authState = ClerkAuth.of(context, listen: false); await Navigator.of(context).push( MaterialPageRoute( settings: const RouteSettings(name: routeName), fullscreenDialog: true, builder: (BuildContext context) { - return AddAccountScreen._(auth: auth); + return AddAccountScreen._(authState: authState); }, ), ); @@ -39,13 +39,13 @@ class _AddAccountScreenState extends State { @override void initState() { super.initState(); - userIds = widget.auth.client.userIds.toSet(); - widget.auth.addListener(_onAuthStateChanged); + userIds = widget.authState.client.userIds.toSet(); + widget.authState.addListener(_onAuthStateChanged); } void _onAuthStateChanged() { // if we successfully logged in and got a new session, pop the screen - final newUserIds = widget.auth.client.userIds.toSet(); + final newUserIds = widget.authState.client.userIds.toSet(); if (newUserIds.difference(userIds).isNotEmpty) { Navigator.of(context).pop(); } @@ -53,14 +53,14 @@ class _AddAccountScreenState extends State { @override void dispose() { - widget.auth.removeListener(_onAuthStateChanged); + widget.authState.removeListener(_onAuthStateChanged); super.dispose(); } @override Widget build(BuildContext context) { return ClerkAuth( - auth: widget.auth, + authState: widget.authState, child: Scaffold( backgroundColor: ClerkColors.whiteSmoke, appBar: AppBar( diff --git a/packages/clerk_flutter/lib/src/widgets/screens/manage_account_screen.dart b/packages/clerk_flutter/lib/src/widgets/screens/manage_account_screen.dart index 9501ca6..01f802d 100644 --- a/packages/clerk_flutter/lib/src/widgets/screens/manage_account_screen.dart +++ b/packages/clerk_flutter/lib/src/widgets/screens/manage_account_screen.dart @@ -5,24 +5,24 @@ import 'package:flutter/material.dart'; class ManageAccountScreen extends StatelessWidget { /// Construct a [ManageAccountScreen] const ManageAccountScreen._({ - required this.auth, + required this.authState, }); - /// An injected [ClerkAuthProvider] - final ClerkAuthProvider auth; + /// An injected [ClerkAuthState] + final ClerkAuthState authState; /// The name of the route to this screen static const routeName = 'clerk_add_account'; /// static method to show an [AddAccountScreen] static Future show(BuildContext context) async { - final auth = ClerkAuth.of(context, listen: false); + final authState = ClerkAuth.of(context, listen: false); await Navigator.of(context).push( MaterialPageRoute( settings: const RouteSettings(name: routeName), fullscreenDialog: true, builder: (BuildContext context) { - return ManageAccountScreen._(auth: auth); + return ManageAccountScreen._(authState: authState); }, ), ); @@ -31,7 +31,7 @@ class ManageAccountScreen extends StatelessWidget { @override Widget build(BuildContext context) { return ClerkAuth( - auth: auth, + authState: authState, child: Scaffold( backgroundColor: ClerkColors.whiteSmoke, appBar: AppBar( diff --git a/packages/clerk_flutter/lib/src/widgets/ui/clerk_error_listener.dart b/packages/clerk_flutter/lib/src/widgets/ui/clerk_error_listener.dart index 242cd06..5093772 100644 --- a/packages/clerk_flutter/lib/src/widgets/ui/clerk_error_listener.dart +++ b/packages/clerk_flutter/lib/src/widgets/ui/clerk_error_listener.dart @@ -9,7 +9,7 @@ typedef ClerkErrorHandler = FutureOr Function( BuildContext context, AuthError error); /// Widget to display error messages as errors are received -/// from the [ClerkAuthProvider]. +/// from the [ClerkAuthState]. /// /// [ClerkErrorListener] must be placed in the widget tree below both a /// [ClerkAuth] widget and a [Scaffold] diff --git a/packages/clerk_flutter/lib/src/widgets/ui/clerk_input_dialog.dart b/packages/clerk_flutter/lib/src/widgets/ui/clerk_input_dialog.dart index f4293b1..8b0eef4 100644 --- a/packages/clerk_flutter/lib/src/widgets/ui/clerk_input_dialog.dart +++ b/packages/clerk_flutter/lib/src/widgets/ui/clerk_input_dialog.dart @@ -8,15 +8,15 @@ class ClerkInputDialog extends StatelessWidget { /// Construct a [ClerkInputDialog] const ClerkInputDialog._({ required this.child, - required this.auth, + required this.authState, this.showOk = true, }); /// The child [Widget] final Widget child; - /// An injected [ClerkAuthProvider] - final ClerkAuthProvider auth; + /// An injected [ClerkAuthState] + final ClerkAuthState authState; /// Show the OK button final bool showOk; @@ -27,11 +27,11 @@ class ClerkInputDialog extends StatelessWidget { required Widget child, bool showOk = true, }) async { - final auth = ClerkAuth.of(context, listen: false); + final authState = ClerkAuth.of(context, listen: false); return await showDialog( context: context, builder: (_) => ClerkInputDialog._( - auth: auth, + authState: authState, showOk: showOk, child: child, ), @@ -40,7 +40,7 @@ class ClerkInputDialog extends StatelessWidget { @override Widget build(BuildContext context) { - final translator = auth.translator; + final translator = authState.translator; return AlertDialog( shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(12)), @@ -49,7 +49,7 @@ class ClerkInputDialog extends StatelessWidget { child: Column( mainAxisSize: MainAxisSize.min, children: [ - ClerkAuth(auth: auth, child: child), + ClerkAuth(authState: authState, child: child), verticalMargin8, Row( mainAxisAlignment: MainAxisAlignment.end, diff --git a/packages/clerk_flutter/lib/src/widgets/user/clerk_user_button.dart b/packages/clerk_flutter/lib/src/widgets/user/clerk_user_button.dart index d3dcd5a..ee888d4 100644 --- a/packages/clerk_flutter/lib/src/widgets/user/clerk_user_button.dart +++ b/packages/clerk_flutter/lib/src/widgets/user/clerk_user_button.dart @@ -23,7 +23,7 @@ class ClerkUserAction { final String label; /// The callback to be invoked when tapped - final FutureOr Function(BuildContext, ClerkAuthProvider) callback; + final FutureOr Function(BuildContext, ClerkAuthState) callback; } /// The [ClerkUserButton] renders a list of all users from @@ -85,24 +85,24 @@ class _ClerkUserButtonState extends State } List _defaultAdditionalActions() { - final auth = ClerkAuth.of(context); + final authState = ClerkAuth.of(context); return [ - if (auth.env.config.singleSessionMode == false) + if (authState.env.config.singleSessionMode == false) ClerkUserAction( asset: ClerkAssets.addIcon, - label: auth.translator.translate('Add account'), + label: authState.translator.translate('Add account'), callback: _addAccount, ), ]; } - Future _addAccount(BuildContext context, ClerkAuthProvider auth) => + Future _addAccount(BuildContext context, ClerkAuthState auth) => AddAccountScreen.show(context); - Future _manageAccount(BuildContext context, ClerkAuthProvider auth) => + Future _manageAccount(BuildContext context, ClerkAuthState auth) => ManageAccountScreen.show(context); - Future _signOut(BuildContext context, ClerkAuthProvider auth) async { + Future _signOut(BuildContext context, ClerkAuthState auth) async { if (auth.client.sessions.length == 1) { await auth(context, () => auth.signOut()); } else { @@ -224,7 +224,7 @@ class _SessionRow extends StatelessWidget { @override Widget build(BuildContext context) { - final auth = ClerkAuth.of(context); + final authState = ClerkAuth.of(context); final user = session.user; return Closeable( closed: closed, @@ -273,7 +273,8 @@ class _SessionRow extends StatelessWidget { child: Padding( padding: horizontalPadding4, child: ClerkMaterialButton( - onPressed: () => action.callback(context, auth), + onPressed: () => + action.callback(context, authState), label: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, diff --git a/packages/clerk_flutter/lib/src/widgets/user/clerk_user_profile.dart b/packages/clerk_flutter/lib/src/widgets/user/clerk_user_profile.dart index b3d7a04..e330b4c 100644 --- a/packages/clerk_flutter/lib/src/widgets/user/clerk_user_profile.dart +++ b/packages/clerk_flutter/lib/src/widgets/user/clerk_user_profile.dart @@ -42,7 +42,7 @@ class _ClerkUserProfileState extends State Future _verifyIdentifyingData( BuildContext context, - ClerkAuthProvider auth, + ClerkAuthState auth, String identifier, ) async { final translator = auth.translator; @@ -72,11 +72,11 @@ class _ClerkUserProfileState extends State Future _addIdentifyingData( BuildContext context, - ClerkAuthProvider auth, + ClerkAuthState auth, clerk.IdentifierType type, ) async { - final auth = ClerkAuth.of(context, listen: false); - final translator = auth.translator; + final authState = ClerkAuth.of(context, listen: false); + final translator = authState.translator; final title = type.name.replaceAll('_', ' ').capitalized; String identifier = ''; @@ -107,9 +107,9 @@ class _ClerkUserProfileState extends State if (submitted) { if (_validate(identifier, type)) { - await auth.addIdentifyingData(identifier, type); + await authState.addIdentifyingData(identifier, type); if (context.mounted) { - await _verifyIdentifyingData(context, auth, identifier); + await _verifyIdentifyingData(context, authState, identifier); } } else { throw clerk.AuthError( @@ -360,12 +360,12 @@ class _EditableUserDataState extends State<_EditableUserData> { Future _update([_]) async { if (isEditing) { - final auth = ClerkAuth.of(context, listen: false); + final authState = ClerkAuth.of(context, listen: false); if (_controller.text != widget.user.name) { - await auth.updateUserName(_controller.text); + await authState.updateUserName(_controller.text); } if (image case File image) { - await auth.updateUserImage(image); + await authState.updateUserImage(image); } } if (context.mounted) {