You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ellipsis ( ... ) is what is causing your "Expression Expected" error. I assume this used in the docs to indicate to the developer that more properties can be added to this return statement.
You can remove the ellipsis and it should work as intended.
return{role: profile.role??"user", ... }// Error
return{role: profile.role??"user"}// Works
As for the docs, I think a better solution here would be to put the ellipsis inside a comment with a message to indicate other properties can be added.
exportconst{ handlers, auth }=NextAuth({providers: [Google({profile(profile){return{role: profile.role??"user",// ... other properties}},})],})
What is the improvement or update you wish to see?
The code must be explained more detail, in the Getting a role part.
The code:
return { role: profile.role ?? "user", ... }
(The ... part shows an error said "Expression Expected)
Is there any context that might help us understand?
Give more details explanation about Role Based Access Control, especially using with database (ex: MongoDb)
Does the docs page already exist? Please link to it.
https://authjs.dev/guides/role-based-access-control
The text was updated successfully, but these errors were encountered: