From 15aecf3ea89593adb8ec629f958c7a6533203324 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 15:36:46 +0000 Subject: [PATCH 1/2] chore(generated): regenerate shared files for UserManagement, Radar --- .last-synced-sha | 2 +- .oagen-manifest.json | 1 - ...AuthSendMagicAuthCodeAndReturnResponse.php | 32 +++++++ lib/Resource/UserCreateResponse.php | 59 ++++++++++++ lib/Service/UserManagement.php | 95 +++++++++++++++++++ tests/Fixtures/authenticate_response.json | 4 +- ...ion_code_session_authenticate_request.json | 4 +- ...horized_connect_application_list_data.json | 8 +- tests/Fixtures/connect_application.json | 4 +- tests/Fixtures/create_user.json | 10 +- tests/Fixtures/email_change.json | 4 +- tests/Fixtures/email_change_confirmation.json | 4 +- .../email_change_confirmation_user.json | 4 +- tests/Fixtures/invitation.json | 4 +- ...d_magic_auth_code_and_return_response.json | 8 ++ .../radar_standalone_assess_request.json | 2 - tests/Fixtures/reset_password_response.json | 4 +- tests/Fixtures/revoke_session.json | 3 +- .../send_verification_email_response.json | 4 +- tests/Fixtures/update_user.json | 8 +- tests/Fixtures/user.json | 4 +- tests/Fixtures/user_api_key.json | 4 +- tests/Fixtures/user_api_key_with_value.json | 4 +- tests/Fixtures/user_create_response.json | 16 ++++ tests/Fixtures/user_invite.json | 4 +- tests/Fixtures/verify_email_response.json | 4 +- tests/Service/UserManagementTest.php | 20 ++++ 27 files changed, 271 insertions(+), 49 deletions(-) diff --git a/.last-synced-sha b/.last-synced-sha index 639e2e87..509956d7 100644 --- a/.last-synced-sha +++ b/.last-synced-sha @@ -1 +1 @@ -4b4e0618779460dbebc1cf5e0f02197c21796d1f +23faa38318d596e581656934ed72c4a18476d742 diff --git a/.oagen-manifest.json b/.oagen-manifest.json index 407f6a69..87aaa63d 100644 --- a/.oagen-manifest.json +++ b/.oagen-manifest.json @@ -1,7 +1,6 @@ { "version": 2, "language": "php", - "generatedAt": "2026-07-02T17:29:52.899Z", "files": [ "lib/Resource/ActionAuthenticationDenied.php", "lib/Resource/ActionAuthenticationDeniedData.php", diff --git a/lib/Resource/MagicAuthSendMagicAuthCodeAndReturnResponse.php b/lib/Resource/MagicAuthSendMagicAuthCodeAndReturnResponse.php index 6641379f..8f2cbb24 100644 --- a/lib/Resource/MagicAuthSendMagicAuthCodeAndReturnResponse.php +++ b/lib/Resource/MagicAuthSendMagicAuthCodeAndReturnResponse.php @@ -11,6 +11,22 @@ use JsonSerializableTrait; public function __construct( + /** Distinguishes the Magic Auth object. */ + public string $object, + /** The unique ID of the Magic Auth code. */ + public string $id, + /** The unique ID of the user. */ + public string $userId, + /** The email address of the user. */ + public string $email, + /** The timestamp when the Magic Auth code expires. */ + public \DateTimeImmutable $expiresAt, + /** An ISO 8601 timestamp. */ + public \DateTimeImmutable $createdAt, + /** An ISO 8601 timestamp. */ + public \DateTimeImmutable $updatedAt, + /** The code used to verify the Magic Auth code. */ + public string $code, /** The ID of the Radar authentication attempt created for this request when Radar is enabled. Pass this value to the authenticate endpoint to associate the subsequent authentication with this Radar attempt. */ public ?string $radarAuthAttemptId = null, ) { @@ -19,6 +35,14 @@ public function __construct( public static function fromArray(array $data): self { return new self( + object: $data['object'] ?? 'magic_auth', + id: $data['id'], + userId: $data['user_id'], + email: $data['email'], + expiresAt: new \DateTimeImmutable($data['expires_at']), + createdAt: new \DateTimeImmutable($data['created_at']), + updatedAt: new \DateTimeImmutable($data['updated_at']), + code: $data['code'], radarAuthAttemptId: $data['radar_auth_attempt_id'] ?? null, ); } @@ -26,6 +50,14 @@ public static function fromArray(array $data): self public function toArray(): array { return [ + 'object' => $this->object, + 'id' => $this->id, + 'user_id' => $this->userId, + 'email' => $this->email, + 'expires_at' => $this->expiresAt->format(\DateTimeInterface::RFC3339_EXTENDED), + 'created_at' => $this->createdAt->format(\DateTimeInterface::RFC3339_EXTENDED), + 'updated_at' => $this->updatedAt->format(\DateTimeInterface::RFC3339_EXTENDED), + 'code' => $this->code, 'radar_auth_attempt_id' => $this->radarAuthAttemptId, ]; } diff --git a/lib/Resource/UserCreateResponse.php b/lib/Resource/UserCreateResponse.php index bf1a0e1c..aac994a1 100644 --- a/lib/Resource/UserCreateResponse.php +++ b/lib/Resource/UserCreateResponse.php @@ -11,6 +11,37 @@ use JsonSerializableTrait; public function __construct( + /** Distinguishes the user object. */ + public string $object, + /** The unique ID of the user. */ + public string $id, + /** The first name of the user. */ + public ?string $firstName, + /** The last name of the user. */ + public ?string $lastName, + /** A URL reference to an image representing the user. */ + public ?string $profilePictureUrl, + /** The email address of the user. */ + public string $email, + /** Whether the user's email has been verified. */ + public bool $emailVerified, + /** The external ID of the user. */ + public ?string $externalId, + /** The timestamp when the user last signed in. */ + public ?\DateTimeImmutable $lastSignInAt, + /** An ISO 8601 timestamp. */ + public \DateTimeImmutable $createdAt, + /** An ISO 8601 timestamp. */ + public \DateTimeImmutable $updatedAt, + /** The user's full name. */ + public ?string $name = null, + /** + * Object containing metadata key/value pairs associated with the user. + * @var array|null + */ + public ?array $metadata = null, + /** The user's preferred locale. */ + public ?string $locale = null, /** The ID of the Radar authentication attempt created for this request when Radar is enabled. Pass this value to the authenticate endpoint to associate the subsequent authentication with this Radar attempt. */ public ?string $radarAuthAttemptId = null, ) { @@ -19,6 +50,20 @@ public function __construct( public static function fromArray(array $data): self { return new self( + object: $data['object'] ?? 'user', + id: $data['id'], + firstName: $data['first_name'] ?? null, + lastName: $data['last_name'] ?? null, + profilePictureUrl: $data['profile_picture_url'] ?? null, + email: $data['email'], + emailVerified: $data['email_verified'], + externalId: $data['external_id'] ?? null, + lastSignInAt: isset($data['last_sign_in_at']) ? new \DateTimeImmutable($data['last_sign_in_at']) : null, + createdAt: new \DateTimeImmutable($data['created_at']), + updatedAt: new \DateTimeImmutable($data['updated_at']), + name: $data['name'] ?? null, + metadata: $data['metadata'] ?? null, + locale: $data['locale'] ?? null, radarAuthAttemptId: $data['radar_auth_attempt_id'] ?? null, ); } @@ -26,6 +71,20 @@ public static function fromArray(array $data): self public function toArray(): array { return [ + 'object' => $this->object, + 'id' => $this->id, + 'first_name' => $this->firstName, + 'last_name' => $this->lastName, + 'profile_picture_url' => $this->profilePictureUrl, + 'email' => $this->email, + 'email_verified' => $this->emailVerified, + 'external_id' => $this->externalId, + 'last_sign_in_at' => $this->lastSignInAt?->format(\DateTimeInterface::RFC3339_EXTENDED), + 'created_at' => $this->createdAt->format(\DateTimeInterface::RFC3339_EXTENDED), + 'updated_at' => $this->updatedAt->format(\DateTimeInterface::RFC3339_EXTENDED), + 'name' => $this->name, + 'metadata' => $this->metadata, + 'locale' => $this->locale, 'radar_auth_attempt_id' => $this->radarAuthAttemptId, ]; } diff --git a/lib/Service/UserManagement.php b/lib/Service/UserManagement.php index a7a6739b..a9905ace 100644 --- a/lib/Service/UserManagement.php +++ b/lib/Service/UserManagement.php @@ -66,6 +66,8 @@ public function getJwks( * @param string|null $ipAddress * @param string|null $deviceId * @param string|null $userAgent + * @param string|null $signalsId + * @param string|null $radarAuthAttemptId * @return \WorkOS\Resource\AuthenticateResponse * @throws \WorkOS\Exception\WorkOSException */ @@ -76,6 +78,8 @@ public function authenticateWithPassword( ?string $ipAddress = null, ?string $deviceId = null, ?string $userAgent = null, + ?string $signalsId = null, + ?string $radarAuthAttemptId = null, ?\WorkOS\RequestOptions $options = null, ): \WorkOS\Resource\AuthenticateResponse { $body = array_filter([ @@ -86,6 +90,8 @@ public function authenticateWithPassword( 'ip_address' => $ipAddress, 'device_id' => $deviceId, 'user_agent' => $userAgent, + 'signals_id' => $signalsId, + 'radar_auth_attempt_id' => $radarAuthAttemptId, ], fn ($v) => $v !== null); $body['client_id'] = $this->client->requireClientId(); $body['client_secret'] = $this->client->requireApiKey(); @@ -106,6 +112,7 @@ public function authenticateWithPassword( * @param string|null $ipAddress * @param string|null $deviceId * @param string|null $userAgent + * @param string|null $signalsId * @return \WorkOS\Resource\AuthenticateResponse * @throws \WorkOS\Exception\WorkOSException */ @@ -116,6 +123,7 @@ public function authenticateWithCode( ?string $ipAddress = null, ?string $deviceId = null, ?string $userAgent = null, + ?string $signalsId = null, ?\WorkOS\RequestOptions $options = null, ): \WorkOS\Resource\AuthenticateResponse { $body = array_filter([ @@ -126,6 +134,7 @@ public function authenticateWithCode( 'ip_address' => $ipAddress, 'device_id' => $deviceId, 'user_agent' => $userAgent, + 'signals_id' => $signalsId, ], fn ($v) => $v !== null); $body['client_id'] = $this->client->requireClientId(); $body['client_secret'] = $this->client->requireApiKey(); @@ -183,6 +192,7 @@ public function authenticateWithRefreshToken( * @param string|null $ipAddress * @param string|null $deviceId * @param string|null $userAgent + * @param string|null $radarAuthAttemptId * @return \WorkOS\Resource\AuthenticateResponse * @throws \WorkOS\Exception\WorkOSException */ @@ -193,6 +203,7 @@ public function authenticateWithMagicAuth( ?string $ipAddress = null, ?string $deviceId = null, ?string $userAgent = null, + ?string $radarAuthAttemptId = null, ?\WorkOS\RequestOptions $options = null, ): \WorkOS\Resource\AuthenticateResponse { $body = array_filter([ @@ -203,6 +214,7 @@ public function authenticateWithMagicAuth( 'ip_address' => $ipAddress, 'device_id' => $deviceId, 'user_agent' => $userAgent, + 'radar_auth_attempt_id' => $radarAuthAttemptId, ], fn ($v) => $v !== null); $body['client_id'] = $this->client->requireClientId(); $body['client_secret'] = $this->client->requireApiKey(); @@ -363,6 +375,89 @@ public function authenticateWithDeviceCode( return AuthenticateResponse::fromArray($response); } + /** + * @param string $code + * @param string $radarChallengeId + * @param string $pendingAuthenticationToken + * @param string|null $ipAddress + * @param string|null $deviceId + * @param string|null $userAgent + * @return \WorkOS\Resource\AuthenticateResponse + * @throws \WorkOS\Exception\WorkOSException + */ + public function authenticateWithRadarEmailChallenge( + string $code, + string $radarChallengeId, + string $pendingAuthenticationToken, + ?string $ipAddress = null, + ?string $deviceId = null, + ?string $userAgent = null, + ?\WorkOS\RequestOptions $options = null, + ): \WorkOS\Resource\AuthenticateResponse { + $body = array_filter([ + 'grant_type' => 'urn:workos:oauth:grant-type:radar-email-challenge:code', + 'code' => $code, + 'radar_challenge_id' => $radarChallengeId, + 'pending_authentication_token' => $pendingAuthenticationToken, + 'ip_address' => $ipAddress, + 'device_id' => $deviceId, + 'user_agent' => $userAgent, + ], fn ($v) => $v !== null); + $body['client_id'] = $this->client->requireClientId(); + $body['client_secret'] = $this->client->requireApiKey(); + + $response = $this->client->request( + method: 'POST', + path: 'user_management/authenticate', + body: $body, + options: $options, + ); + return AuthenticateResponse::fromArray($response); + } + + /** + * @param string $code + * @param string $verificationId + * @param string $phoneNumber + * @param string $pendingAuthenticationToken + * @param string|null $ipAddress + * @param string|null $deviceId + * @param string|null $userAgent + * @return \WorkOS\Resource\AuthenticateResponse + * @throws \WorkOS\Exception\WorkOSException + */ + public function authenticateWithRadarSmsChallenge( + string $code, + string $verificationId, + string $phoneNumber, + string $pendingAuthenticationToken, + ?string $ipAddress = null, + ?string $deviceId = null, + ?string $userAgent = null, + ?\WorkOS\RequestOptions $options = null, + ): \WorkOS\Resource\AuthenticateResponse { + $body = array_filter([ + 'grant_type' => 'urn:workos:oauth:grant-type:radar-sms-challenge:code', + 'code' => $code, + 'verification_id' => $verificationId, + 'phone_number' => $phoneNumber, + 'pending_authentication_token' => $pendingAuthenticationToken, + 'ip_address' => $ipAddress, + 'device_id' => $deviceId, + 'user_agent' => $userAgent, + ], fn ($v) => $v !== null); + $body['client_id'] = $this->client->requireClientId(); + $body['client_secret'] = $this->client->requireApiKey(); + + $response = $this->client->request( + method: 'POST', + path: 'user_management/authenticate', + body: $body, + options: $options, + ); + return AuthenticateResponse::fromArray($response); + } + /** * Get an authorization URL * diff --git a/tests/Fixtures/authenticate_response.json b/tests/Fixtures/authenticate_response.json index d3df5158..ab7ea006 100644 --- a/tests/Fixtures/authenticate_response.json +++ b/tests/Fixtures/authenticate_response.json @@ -4,6 +4,7 @@ "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", + "name": "Marcelina Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": true, @@ -14,8 +15,7 @@ "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "name": "Marcelina Davis" + "updated_at": "2026-01-15T12:00:00.000Z" }, "organization_id": "org_01H945H0YD4F97JN9MATX7BYAG", "authkit_authorization_code": "authkit_authz_code_abc123", diff --git a/tests/Fixtures/authorization_code_session_authenticate_request.json b/tests/Fixtures/authorization_code_session_authenticate_request.json index 14a469f7..0f50d5c6 100644 --- a/tests/Fixtures/authorization_code_session_authenticate_request.json +++ b/tests/Fixtures/authorization_code_session_authenticate_request.json @@ -3,10 +3,10 @@ "client_secret": "sk_test_....", "grant_type": "authorization_code", "code": "vBqZKaPpsnJlPfXiDqN7b6VTz", + "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", + "invitation_token": "inv_tok_01HXYZ123456789ABCDEFGHIJ", "ip_address": "203.0.113.42", "device_id": "device_01HXYZ123456789ABCDEFGHIJ", "user_agent": "Mozilla/5.0", - "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", - "invitation_token": "inv_tok_01HXYZ123456789ABCDEFGHIJ", "signals_id": "01JBS0GN92GC2RJQS4X9DBPQ2A" } diff --git a/tests/Fixtures/authorized_connect_application_list_data.json b/tests/Fixtures/authorized_connect_application_list_data.json index 4ea4c32e..c4fd3b97 100644 --- a/tests/Fixtures/authorized_connect_application_list_data.json +++ b/tests/Fixtures/authorized_connect_application_list_data.json @@ -6,6 +6,7 @@ "profile", "email" ], + "oauth_resource": "https://api.example.com/resource", "application": { "object": "connect_application", "id": "conn_app_01HXYZ123456789ABCDEFGHIJ", @@ -18,9 +19,6 @@ "email" ], "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "application_type": "m2m", - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT" - }, - "oauth_resource": "https://api.example.com/resource" + "updated_at": "2026-01-15T12:00:00.000Z" + } } diff --git a/tests/Fixtures/connect_application.json b/tests/Fixtures/connect_application.json index 2498d8fd..94258b88 100644 --- a/tests/Fixtures/connect_application.json +++ b/tests/Fixtures/connect_application.json @@ -10,7 +10,5 @@ "email" ], "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "application_type": "m2m", - "organization_id": "org_01EHZNVPK3SFK441A1RGBFSHRT" + "updated_at": "2026-01-15T12:00:00.000Z" } diff --git a/tests/Fixtures/create_user.json b/tests/Fixtures/create_user.json index 0e134548..a851bca9 100644 --- a/tests/Fixtures/create_user.json +++ b/tests/Fixtures/create_user.json @@ -1,17 +1,17 @@ { "email": "marcelina.davis@example.com", - "password": "strong_password_123!", - "password_hash": "$2a$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy", - "password_hash_type": "bcrypt", "first_name": "Marcelina", "last_name": "Davis", + "name": "Marcelina Davis", "email_verified": true, "metadata": { "timezone": "America/New_York" }, "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", - "name": "Marcelina Davis", "ip_address": "203.0.113.42", "user_agent": "Mozilla/5.0", - "signals_id": "01JBS0GN92GC2RJQS4X9DBPQ2A" + "signals_id": "01JBS0GN92GC2RJQS4X9DBPQ2A", + "password": "strong_password_123!", + "password_hash": "$2a$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy", + "password_hash_type": "bcrypt" } diff --git a/tests/Fixtures/email_change.json b/tests/Fixtures/email_change.json index 39fdd60c..72e1437a 100644 --- a/tests/Fixtures/email_change.json +++ b/tests/Fixtures/email_change.json @@ -5,6 +5,7 @@ "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", + "name": "Marcelina Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": true, @@ -15,8 +16,7 @@ "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "name": "Marcelina Davis" + "updated_at": "2026-01-15T12:00:00.000Z" }, "new_email": "new.email@example.com", "expires_at": "2026-01-15T12:00:00.000Z", diff --git a/tests/Fixtures/email_change_confirmation.json b/tests/Fixtures/email_change_confirmation.json index 869bbb06..ad462644 100644 --- a/tests/Fixtures/email_change_confirmation.json +++ b/tests/Fixtures/email_change_confirmation.json @@ -5,6 +5,7 @@ "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", + "name": "Marcelina Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "new.email@example.com", "email_verified": true, @@ -15,7 +16,6 @@ "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "name": "Marcelina Davis" + "updated_at": "2026-01-15T12:00:00.000Z" } } diff --git a/tests/Fixtures/email_change_confirmation_user.json b/tests/Fixtures/email_change_confirmation_user.json index 7c9f3888..ce9078ee 100644 --- a/tests/Fixtures/email_change_confirmation_user.json +++ b/tests/Fixtures/email_change_confirmation_user.json @@ -3,6 +3,7 @@ "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", + "name": "Marcelina Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "new.email@example.com", "email_verified": true, @@ -13,6 +14,5 @@ "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "name": "Marcelina Davis" + "updated_at": "2026-01-15T12:00:00.000Z" } diff --git a/tests/Fixtures/invitation.json b/tests/Fixtures/invitation.json index 5dabcd8e..c97b3187 100644 --- a/tests/Fixtures/invitation.json +++ b/tests/Fixtures/invitation.json @@ -9,9 +9,9 @@ "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", + "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "token": "Z1uX3RbwcIl5fIGJJJCXXisdI", - "accept_invitation_url": "https://your-app.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI", - "role_slug": "admin" + "accept_invitation_url": "https://your-app.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI" } diff --git a/tests/Fixtures/magic_auth_send_magic_auth_code_and_return_response.json b/tests/Fixtures/magic_auth_send_magic_auth_code_and_return_response.json index 762e42d0..6310986b 100644 --- a/tests/Fixtures/magic_auth_send_magic_auth_code_and_return_response.json +++ b/tests/Fixtures/magic_auth_send_magic_auth_code_and_return_response.json @@ -1,3 +1,11 @@ { + "object": "magic_auth", + "id": "magic_auth_01HWZBQZY2M3AMQW166Q22K88F", + "user_id": "user_01E4ZCR3C56J083X43JQXF3JK5", + "email": "marcelina.davis@example.com", + "expires_at": "2026-01-15T12:00:00.000Z", + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z", + "code": "123456", "radar_auth_attempt_id": "radar_auth_attempt_01HXYZ123456789ABCDEFGHIJ" } diff --git a/tests/Fixtures/radar_standalone_assess_request.json b/tests/Fixtures/radar_standalone_assess_request.json index 024436c7..969ae0ca 100644 --- a/tests/Fixtures/radar_standalone_assess_request.json +++ b/tests/Fixtures/radar_standalone_assess_request.json @@ -4,7 +4,5 @@ "email": "user@example.com", "auth_method": "Password", "action": "sign-in", - "device_fingerprint": "fp_abc123", - "bot_score": "0.1", "signals_id": "01JBS0GN92GC2RJQS4X9DBPQ2A" } diff --git a/tests/Fixtures/reset_password_response.json b/tests/Fixtures/reset_password_response.json index efd50117..c08cb1f5 100644 --- a/tests/Fixtures/reset_password_response.json +++ b/tests/Fixtures/reset_password_response.json @@ -4,6 +4,7 @@ "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", + "name": "Marcelina Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": true, @@ -14,7 +15,6 @@ "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "name": "Marcelina Davis" + "updated_at": "2026-01-15T12:00:00.000Z" } } diff --git a/tests/Fixtures/revoke_session.json b/tests/Fixtures/revoke_session.json index c1d3e07f..b525a0da 100644 --- a/tests/Fixtures/revoke_session.json +++ b/tests/Fixtures/revoke_session.json @@ -1,4 +1,3 @@ { - "session_id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8", - "return_to": "https://example.com" + "session_id": "session_01H93ZY4F80QPBEZ1R5B2SHQG8" } diff --git a/tests/Fixtures/send_verification_email_response.json b/tests/Fixtures/send_verification_email_response.json index efd50117..c08cb1f5 100644 --- a/tests/Fixtures/send_verification_email_response.json +++ b/tests/Fixtures/send_verification_email_response.json @@ -4,6 +4,7 @@ "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", + "name": "Marcelina Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": true, @@ -14,7 +15,6 @@ "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "name": "Marcelina Davis" + "updated_at": "2026-01-15T12:00:00.000Z" } } diff --git a/tests/Fixtures/update_user.json b/tests/Fixtures/update_user.json index 7742b5bd..d00ee5ca 100644 --- a/tests/Fixtures/update_user.json +++ b/tests/Fixtures/update_user.json @@ -2,14 +2,14 @@ "email": "marcelina.davis@example.com", "first_name": "Marcelina", "last_name": "Davis", + "name": "Marcelina Davis", "email_verified": true, - "password": "strong_password_123!", - "password_hash": "$2a$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy", - "password_hash_type": "bcrypt", "metadata": { "timezone": "America/New_York" }, "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", "locale": "en-US", - "name": "Marcelina Davis" + "password": "strong_password_123!", + "password_hash": "$2a$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy", + "password_hash_type": "bcrypt" } diff --git a/tests/Fixtures/user.json b/tests/Fixtures/user.json index 3a0564d4..9eee4058 100644 --- a/tests/Fixtures/user.json +++ b/tests/Fixtures/user.json @@ -3,6 +3,7 @@ "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", + "name": "Marcelina Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": true, @@ -13,6 +14,5 @@ "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "name": "Marcelina Davis" + "updated_at": "2026-01-15T12:00:00.000Z" } diff --git a/tests/Fixtures/user_api_key.json b/tests/Fixtures/user_api_key.json index 61e99cfa..e669b312 100644 --- a/tests/Fixtures/user_api_key.json +++ b/tests/Fixtures/user_api_key.json @@ -9,11 +9,11 @@ "name": "Production API Key", "obfuscated_value": "sk_...3456", "last_used_at": null, + "expires_at": null, "permissions": [ "posts:read", "posts:write" ], "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "expires_at": null + "updated_at": "2026-01-15T12:00:00.000Z" } diff --git a/tests/Fixtures/user_api_key_with_value.json b/tests/Fixtures/user_api_key_with_value.json index 260f3835..7aec864a 100644 --- a/tests/Fixtures/user_api_key_with_value.json +++ b/tests/Fixtures/user_api_key_with_value.json @@ -9,12 +9,12 @@ "name": "Production API Key", "obfuscated_value": "sk_...3456", "last_used_at": null, + "expires_at": "2030-01-01T00:00:00.000Z", "permissions": [ "posts:read", "posts:write" ], "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", - "value": "sk_abcdefghijklmnop123456", - "expires_at": "2030-01-01T00:00:00.000Z" + "value": "sk_abcdefghijklmnop123456" } diff --git a/tests/Fixtures/user_create_response.json b/tests/Fixtures/user_create_response.json index 762e42d0..3c418ae0 100644 --- a/tests/Fixtures/user_create_response.json +++ b/tests/Fixtures/user_create_response.json @@ -1,3 +1,19 @@ { + "object": "user", + "id": "user_01E4ZCR3C56J083X43JQXF3JK5", + "first_name": "Marcelina", + "last_name": "Davis", + "name": "Marcelina Davis", + "profile_picture_url": "https://workoscdn.com/images/v1/123abc", + "email": "marcelina.davis@example.com", + "email_verified": true, + "external_id": "f1ffa2b2-c20b-4d39-be5c-212726e11222", + "metadata": { + "timezone": "America/New_York" + }, + "last_sign_in_at": "2025-06-25T19:07:33.155Z", + "locale": "en-US", + "created_at": "2026-01-15T12:00:00.000Z", + "updated_at": "2026-01-15T12:00:00.000Z", "radar_auth_attempt_id": "radar_auth_attempt_01HXYZ123456789ABCDEFGHIJ" } diff --git a/tests/Fixtures/user_invite.json b/tests/Fixtures/user_invite.json index 9c91ed19..6deb2ab7 100644 --- a/tests/Fixtures/user_invite.json +++ b/tests/Fixtures/user_invite.json @@ -9,9 +9,9 @@ "organization_id": "org_01E4ZCR3C56J083X43JQXF3JK5", "inviter_user_id": "user_01HYGBX8ZGD19949T3BM4FW1C3", "accepted_user_id": null, + "role_slug": "admin", "created_at": "2026-01-15T12:00:00.000Z", "updated_at": "2026-01-15T12:00:00.000Z", "token": "Z1uX3RbwcIl5fIGJJJCXXisdI", - "accept_invitation_url": "https://your-app.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI", - "role_slug": "admin" + "accept_invitation_url": "https://your-app.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI" } diff --git a/tests/Fixtures/verify_email_response.json b/tests/Fixtures/verify_email_response.json index efd50117..c08cb1f5 100644 --- a/tests/Fixtures/verify_email_response.json +++ b/tests/Fixtures/verify_email_response.json @@ -4,6 +4,7 @@ "id": "user_01E4ZCR3C56J083X43JQXF3JK5", "first_name": "Marcelina", "last_name": "Davis", + "name": "Marcelina Davis", "profile_picture_url": "https://workoscdn.com/images/v1/123abc", "email": "marcelina.davis@example.com", "email_verified": true, @@ -14,7 +15,6 @@ "last_sign_in_at": "2025-06-25T19:07:33.155Z", "locale": "en-US", "created_at": "2026-01-15T12:00:00.000Z", - "updated_at": "2026-01-15T12:00:00.000Z", - "name": "Marcelina Davis" + "updated_at": "2026-01-15T12:00:00.000Z" } } diff --git a/tests/Service/UserManagementTest.php b/tests/Service/UserManagementTest.php index 5d8dd5da..c5208b1e 100644 --- a/tests/Service/UserManagementTest.php +++ b/tests/Service/UserManagementTest.php @@ -216,6 +216,8 @@ public function testCreateUser(): void $client = $this->createMockClient([['status' => 200, 'body' => $fixture]]); $result = $client->userManagement()->createUser(email: 'test_value'); $this->assertInstanceOf(\WorkOS\Resource\UserCreateResponse::class, $result); + $this->assertSame($fixture['id'], $result->id); + $this->assertSame($fixture['email'], $result->email); $this->assertIsArray($result->toArray()); $request = $this->getLastRequest(); $this->assertSame('POST', $request->getMethod()); @@ -498,6 +500,8 @@ public function testCreateMagicAuth(): void $client = $this->createMockClient([['status' => 200, 'body' => $fixture]]); $result = $client->userManagement()->createMagicAuth(email: 'test_value'); $this->assertInstanceOf(\WorkOS\Resource\MagicAuthSendMagicAuthCodeAndReturnResponse::class, $result); + $this->assertSame($fixture['id'], $result->id); + $this->assertSame($fixture['user_id'], $result->userId); $this->assertIsArray($result->toArray()); $request = $this->getLastRequest(); $this->assertSame('POST', $request->getMethod()); @@ -675,6 +679,22 @@ public function testAuthenticateWithDeviceCode(): void $this->assertInstanceOf(\WorkOS\Resource\AuthenticateResponse::class, $result); } + public function testAuthenticateWithRadarEmailChallenge(): void + { + $fixture = $this->loadFixture('authenticate_response'); + $client = $this->createMockClient([['status' => 200, 'body' => $fixture]]); + $result = $client->userManagement()->authenticateWithRadarEmailChallenge(code: 'test_value', radarChallengeId: 'test_value', pendingAuthenticationToken: 'test_value'); + $this->assertInstanceOf(\WorkOS\Resource\AuthenticateResponse::class, $result); + } + + public function testAuthenticateWithRadarSmsChallenge(): void + { + $fixture = $this->loadFixture('authenticate_response'); + $client = $this->createMockClient([['status' => 200, 'body' => $fixture]]); + $result = $client->userManagement()->authenticateWithRadarSmsChallenge(code: 'test_value', verificationId: 'test_value', phoneNumber: 'test_value', pendingAuthenticationToken: 'test_value'); + $this->assertInstanceOf(\WorkOS\Resource\AuthenticateResponse::class, $result); + } + public function testPaginationBoundary(): void { $fixture = $this->loadFixture('list_cors_origin_response'); From 44709af8c499a40b2011069ca2c5831f0d9096f7 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 15:36:50 +0000 Subject: [PATCH 2/2] chore(generated): add release notes fragment --- ...6-50-a2c464df57c9c25ad289cf11417e5df4ada5c726.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .changelog-pending/2026-07-06T15-36-50-a2c464df57c9c25ad289cf11417e5df4ada5c726.md diff --git a/.changelog-pending/2026-07-06T15-36-50-a2c464df57c9c25ad289cf11417e5df4ada5c726.md b/.changelog-pending/2026-07-06T15-36-50-a2c464df57c9c25ad289cf11417e5df4ada5c726.md new file mode 100644 index 00000000..34e78914 --- /dev/null +++ b/.changelog-pending/2026-07-06T15-36-50-a2c464df57c9c25ad289cf11417e5df4ada5c726.md @@ -0,0 +1,13 @@ +* [#416](https://github.com/workos/workos-php/pull/416) fix(generated): regenerate from spec + + **Features** + * **[user_management](https://workos.com/docs/reference/authkit/user)**: + * Added model `UserRoleAssignmentSource` + * Added `source` to `UserRoleAssignment` + * Added enum `UserRoleAssignmentSourceType` + * Added parameter `UserManagementAuthentication.authorize.max_age` + * Added endpoint `GET /user_management/cors_origins` + * Added endpoint `GET /user_management/redirect_uris` + + **Fixes** + * Restore mistakenly removed CreateMagicAuth logic from previous release