For dedicated server there is a method for creating the session provided in the GameSession class:
void ASwatGameSession::RegisterServer()
{
TSharedPtr<const FUniqueNetId> UserId;
auto OnlineSubsystem = IOnlineSubsystem::Get();
if (OnlineSubsystem)
{
auto IdentityInterface = OnlineSubsystem->GetIdentityInterface();
if (IdentityInterface.IsValid())
{
UserId = IdentityInterface->GetUniquePlayerId(0);
}
}
CreateGameSession(UserId, SwatGameMode->GetClass(), GetWorld()->GetMapName());
}