From 5617ce6c0395f9025a7deb478d0c5e2a8247c939 Mon Sep 17 00:00:00 2001 From: apoorv_gupta Date: Wed, 26 Feb 2025 22:28:03 +0530 Subject: [PATCH 1/2] fix(profile struct): :zap: fix cast of profile and token, to cast profile map to profile struct --- lib/workos/sso/profile-and-token.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/workos/sso/profile-and-token.ex b/lib/workos/sso/profile-and-token.ex index 990b426..51cb237 100644 --- a/lib/workos/sso/profile-and-token.ex +++ b/lib/workos/sso/profile-and-token.ex @@ -19,10 +19,11 @@ defmodule WorkOS.SSO.ProfileAndToken do ] @impl true + @spec cast(map :: map()) :: t() def cast(map) do %__MODULE__{ access_token: map["access_token"], - profile: map["profile"] + profile: Profile.cast(map["profile"]) } end end From 6c09ab8bef9f125e95e30c078852e2ad5aa0c0fc Mon Sep 17 00:00:00 2001 From: apoorv_gupta Date: Wed, 26 Feb 2025 22:28:40 +0530 Subject: [PATCH 2/2] fix(profile): :bug: ensure casting of all fields in profile --- lib/workos/sso/profile.ex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/workos/sso/profile.ex b/lib/workos/sso/profile.ex index 1a85467..5816c95 100644 --- a/lib/workos/sso/profile.ex +++ b/lib/workos/sso/profile.ex @@ -33,6 +33,7 @@ defmodule WorkOS.SSO.Profile do ] @impl true + @spec cast(map :: map()) :: t() def cast(map) do %__MODULE__{ id: map["id"], @@ -41,7 +42,8 @@ defmodule WorkOS.SSO.Profile do connection_id: map["connection_id"], connection_type: map["connection_type"], email: map["email"], - first_name: map["last_name"], + first_name: map["first_name"], + last_name: map["last_name"], groups: map["groups"], raw_attributes: map["raw_attributes"] }