I used the following code to generate a session in a service. However, the id for the session is set to null. Can you please tell me what is the best approach for this to be done?
The use case is that an administrator is creating a user who is then emailed a link with a pre-set session since they have not yet logged in. We will then use that session id for authorizing their access to perform first login account updates which include password setup.
var contactSession = new AuthUserSession
{
UserAuthId = primaryContact.Id.RemoveRavenCollectionName(),
Email = primaryContact.Email,
DisplayName = primaryContact.FirstName,
FirstName = primaryContact.FirstName,
LastName = primaryContact.LastName,
IsAuthenticated = true,
Roles = new List<string> {primaryContact.Role.ToString()},
};
this.SaveSession(contactSession);
var token = contactSession.Id;