bRequireLoginCredentials
bRequireLoginCredentials
#Overview
name: bRequireLoginCredentials
The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.
It is referenced in 5 C++ source files.
#Summary
#Usage in the C++ source code
The purpose of bRequireLoginCredentials is to control the login behavior in the Null Online Subsystem, which is a mock implementation of the Online Subsystem interface in Unreal Engine 5. This variable determines whether the system should require actual login credentials (username and password) or allow automatic login without credentials.
This setting variable is primarily used by the Online Subsystem Null plugin, which is part of Unreal Engine’s networking and online services framework. Specifically, it’s used in the FOnlineIdentityNull class, which handles user identity and authentication for the Null Online Subsystem.
The value of this variable is set in multiple ways:
- It’s initialized as a static boolean in the FOnlineSubsystemNull class.
- It can be modified through a console variable “OSSNull.RequireLoginCredentials”.
- It’s also read from the engine configuration file (GEngineIni) during the initialization of the Null Online Subsystem.
This variable interacts with other variables and functions in the Online Subsystem Null, such as:
- The LoginInternal function, which checks this variable to determine if it should reject logins with empty credentials.
- The AutoLogin function, which uses this variable to decide whether to attempt an automatic login with empty credentials.
Developers should be aware that:
- When set to true, the system will require valid login credentials, simulating an external authentication service.
- When set to false (default), it allows automatic login without credentials, which is more typical for most gaming platforms.
Best practices when using this variable include:
- Use it to simulate different login scenarios during development and testing.
- Be consistent in its usage across your project to avoid unexpected authentication behaviors.
- Consider the implications on your game’s design and user experience when deciding whether to require login credentials.
- Use the console variable or engine configuration file to easily toggle this behavior for testing purposes.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:2316, section: [OnlineSubsystemNull]
- INI Section:
OnlineSubsystemNull - Raw value:
false - Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemNull/Source/Private/OnlineIdentityNull.cpp:102
Scope (from outer to inner):
file
function bool FOnlineIdentityNull::LoginInternal
Source code excerpt:
ErrorStr = TEXT("Only supports login using ShowLoginUI");
}
else if (FOnlineSubsystemNull::bRequireLoginCredentials && AccountCredentials.Id.IsEmpty())
{
ErrorStr = TEXT("Invalid account id, string empty");
}
else
{
FUniqueNetIdPtr* UserId = UserIds.Find(LocalUserNum);
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemNull/Source/Private/OnlineIdentityNull.cpp:200
Scope (from outer to inner):
file
function bool FOnlineIdentityNull::AutoLogin
Source code excerpt:
}
}
else if (!FOnlineSubsystemNull::bRequireLoginCredentials)
{
// Act like a console and login with empty auth
return Login(LocalUserNum, FOnlineAccountCredentials());
}
else if (bEnableWarning)
{
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemNull/Source/Private/OnlineSubsystemNull.cpp:230
Scope: file
Source code excerpt:
ECVF_Default | ECVF_Cheat);
bool FOnlineSubsystemNull::bRequireLoginCredentials = false;
FAutoConsoleVariableRef CVarRequireLoginCredentials(
TEXT("OSSNull.RequireLoginCredentials"),
FOnlineSubsystemNull::bRequireLoginCredentials,
TEXT("True if login should require a user/pass to act like an external service, false to match most platforms and use the default"),
ECVF_Default | ECVF_Cheat);
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemNull/Source/Private/OnlineSubsystemNull.cpp:280
Scope (from outer to inner):
file
function bool FOnlineSubsystemNull::Init
Source code excerpt:
GConfig->GetBool(TEXT("OnlineSubsystemNull"), TEXT("bRequireShowLoginUI"), bRequireShowLoginUI, GEngineIni);
GConfig->GetBool(TEXT("OnlineSubsystemNull"), TEXT("bForceShowLoginUIUserChange"), bForceShowLoginUIUserChange, GEngineIni);
GConfig->GetBool(TEXT("OnlineSubsystemNull"), TEXT("bRequireLoginCredentials"), bRequireLoginCredentials, GEngineIni);
GConfig->GetBool(TEXT("OnlineSubsystemNull"), TEXT("bAddUserNumToNullId"), bAddUserNumToNullId, GEngineIni);
GConfig->GetBool(TEXT("OnlineSubsystemNull"), TEXT("bForceStableNullId"), bForceStableNullId, GEngineIni);
GConfig->GetBool(TEXT("OnlineSubsystemNull"), TEXT("bForceOfflineMode"), bForceOfflineMode, GEngineIni);
GConfig->GetBool(TEXT("OnlineSubsystemNull"), TEXT("bOnlineRequiresSecondLogin"), bOnlineRequiresSecondLogin, GEngineIni);
if (FParse::Param(FCommandLine::Get(), TEXT("StableNullID")))
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemNull/Source/Public/OnlineSubsystemNull.h:114
Scope (from outer to inner):
file
class class FOnlineSubsystemNull : public FOnlineSubsystemImpl
Source code excerpt:
/** True if login should require a user/pass to act like an external service, false to match most platforms and use the default */
static bool bRequireLoginCredentials;
/** True if login name should include the local user number, which allows different stable IDs per user num */
static bool bAddUserNumToNullId;
/** True if it should use a system-stable null Id for login, same as -StableNullID on command line */
static bool bForceStableNullId;