updateAccountOnSignIn

How updateAccountOnSignIn works, I have a genericOauth configuration, where user has extra role property, which can be change in future. I want to take that role and update the user whenever he sign in.
2 Replies
KiNFiSH
KiNFiSH4d ago
one thing you can work with db hooks also if your usecase actually works with the mapToUserProfile - you can use that -
plugins: [
genericOAuth({
config: [{
providerId: "your-provider",
clientId: "your-client-id",
clientSecret: "your-client-secret",
mapProfileToUser: async (profile) => {
return {
// Map other user fields
role: profile.role || "default-role" // Set the role from the provider's profile
};
}
}]
})
]
plugins: [
genericOAuth({
config: [{
providerId: "your-provider",
clientId: "your-client-id",
clientSecret: "your-client-secret",
mapProfileToUser: async (profile) => {
return {
// Map other user fields
role: profile.role || "default-role" // Set the role from the provider's profile
};
}
}]
})
]
Ashwanee Kumar Gupta
Yes this is my current setup. But if the role changes on Identity provider configuration, I want to update the users collection based on that. Now only user is created when first time sign in happens, later user is not updating on sign in.

Did you find this page helpful?