AshAuthentication.Strategy.OAuth2.UserInfoToAttributes
(ash_authentication v5.0.0-rc.7)
Copy Markdown
View Source
Sets resource attributes from the user_info argument provided by an OAuth2 callback.
Assent normalises all providers to OpenID Connect standard string-keyed fields
(e.g. "email", "name", "sub"), so this change works consistently across providers.
Options
:fields- a list of fields to copy fromuser_info. Each entry can be:- An atom (e.g.
:email) — maps"email"from user_info to the:emailattribute - A
{source, attribute}tuple (e.g.{:email, :user_email}) — maps"email"from user_info to the:user_emailattribute
Defaults to
[:email].- An atom (e.g.
Examples
change {AshAuthentication.Strategy.OAuth2.UserInfoToAttributes, fields: [:email, :name]}
change {AshAuthentication.Strategy.OAuth2.UserInfoToAttributes, fields: [email: :user_email]}