From 625e0e6634344605c5a8a6ce3e4f0c21737da493 Mon Sep 17 00:00:00 2001 From: Lars Wikman Date: Thu, 26 Oct 2023 00:09:54 +0200 Subject: [PATCH] improvement: Add id as an option for sourcing uid for UserIdentity (#481) --- .../user_identity/upsert_identity_change.ex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ash_authentication/user_identity/upsert_identity_change.ex b/lib/ash_authentication/user_identity/upsert_identity_change.ex index 92361581..3309a4d9 100644 --- a/lib/ash_authentication/user_identity/upsert_identity_change.ex +++ b/lib/ash_authentication/user_identity/upsert_identity_change.ex @@ -31,7 +31,10 @@ defmodule AshAuthentication.UserIdentity.UpsertIdentityChange do uid = user_info - |> Map.take(["uid", "sub"]) + # uid is a convention + # sub is supposedly from the spec + # id is from what has been seen from Google + |> Map.take(["uid", "sub", "id"]) |> Map.values() |> Enum.reject(&is_nil/1) |> List.first()