-
Following #11386, how can I set the user as 'Internal' only under certain conditions — for example, when the Google account belongs to the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Hi @fdcastel. An OAuth source property mapping should achieve what you're after. Something like this: from authentik.core.models import UserTypes
email_name, email_domain = info["email"].rsplit("@", 1)
is_matching_domain = email_domain.endswith("contoso.com")
user_type = UserTypes.INTERNAL if is_matching_domain else UserTypes.EXTERNAL
return {
"type": user_type,
} |
Beta Was this translation helpful? Give feedback.
-
@dewi-tik The code looks great to me at first glance. However, when I tested it using an account from "@contoso.com", I initially received a "Server Error" message. On the second attempt, it went through—but the user ended up being registered as "External". Any suggestions on how I can go about debugging this? |
Beta Was this translation helpful? Give feedback.
Hi @fdcastel. An OAuth source property mapping should achieve what you're after. Something like this: