I'm using Next Auth to handle authentication on my project but I'm having a small issue. When you create a new account by signing in with a social provider like github or twitter, You get an object like this:
_id:61dc91ff7581802bcba5d3b4
name:Array
email:"xxxxxxxxxxx@aol.com"
image:"xxxxxxxxxxx.jpg"
emailVerified:null
__v:1
However because of the nature of the application I need the object to have a few more properties automatically generated when the account is created or it leads to problems where react can't render the page because it is trying to read a property that doesn't exist. For example the app can't render the page when its looking for {session?.watchlists[i].watchlistName}, if watchlists isn't an existing property.
This is what I need:
_id:61dc91ff7581802bcba5d3b4
name:Array
email:"xxxxxxxxxx@aol.com"
image:"xxxxxxxxxx.jpg"
emailVerified:null
followers:Array
following:Array
watchlists:Array
__v:1
status:""
The followers, following, and watchlists can be empty arrays, and status an empty string.
How do I go about adding these empty property fields when an account is created ?