MeURL
MeURL
#Overview
name: MeURL
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 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of MeURL is to store the URL for accessing Facebook’s API to retrieve personal details of a user. This variable is crucial for the Facebook integration within the Unreal Engine’s online subsystem.
The MeURL variable is primarily used by the OnlineSubsystemFacebook module, specifically within the OnlineIdentityFacebookCommon class. This class is part of the online identity system that integrates Facebook authentication and user profile retrieval into Unreal Engine games.
The value of this variable is set in the constructor of FOnlineIdentityFacebookCommon. It’s read from the game’s configuration file (DefaultEngine.ini) under the [OnlineSubsystemFacebook.OnlineIdentityFacebook] section. If the value is not found in the configuration, a warning log is generated.
MeURL interacts with other variables such as AccessToken and ProfileFields. It’s used in conjunction with these to construct the final URL for making API requests to Facebook.
Developers must be aware of the following when using this variable:
- It needs to be properly configured in the DefaultEngine.ini file.
- The URL may contain a placeholder (`ver) which is replaced with the API version at runtime.
- The URL is used in conjunction with an access token to make authenticated requests to Facebook’s API.
Best practices for using this variable include:
- Ensure the MeURL is correctly set in the configuration file.
- Keep the URL format up-to-date with Facebook’s API requirements.
- Handle cases where the URL might be empty or improperly formatted.
- Use it in conjunction with proper error handling and logging for API requests.
- Be mindful of Facebook’s API usage limits and guidelines when making requests using this URL.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:2286, section: [OnlineSubsystemFacebook.OnlineIdentityFacebook]
- INI Section:
OnlineSubsystemFacebook.OnlineIdentityFacebook
- Raw value:
"https://graph.facebook.com/
ver/me?access_token=token"
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemFacebook/Source/Private/OnlineIdentityFacebookCommon.cpp:16
Scope (from outer to inner):
file
function FOnlineIdentityFacebookCommon::FOnlineIdentityFacebookCommon
Source code excerpt:
: FacebookSubsystem(InSubsystem)
{
if (!GConfig->GetString(TEXT("OnlineSubsystemFacebook.OnlineIdentityFacebook"), TEXT("MeURL"), MeURL, GEngineIni))
{
UE_LOG_ONLINE_IDENTITY(Warning, TEXT("Missing MeURL= in [OnlineSubsystemFacebook.OnlineIdentityFacebook] of DefaultEngine.ini"));
}
MeURL.ReplaceInline(TEXT("`ver"), *InSubsystem->GetAPIVer());
// Setup permission scope fields
GConfig->GetArray(TEXT("OnlineSubsystemFacebook.OnlineIdentityFacebook"), TEXT("ProfileFields"), ProfileFields, GEngineIni);
// Add a few basic fields
ProfileFields.AddUnique(TEXT(ME_FIELD_ID));
ProfileFields.AddUnique(TEXT(ME_FIELD_NAME));
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemFacebook/Source/Private/OnlineIdentityFacebookCommon.cpp:74
Scope (from outer to inner):
file
function void FOnlineIdentityFacebookCommon::ProfileRequest
Source code excerpt:
if (LocalUserNum >= 0 && LocalUserNum < MAX_LOCAL_PLAYERS)
{
if (!MeURL.IsEmpty())
{
if (!AccessToken.IsEmpty())
{
bStarted = true;
// kick off http request to get user info with the access token
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemFacebook/Source/Private/OnlineIdentityFacebookCommon.cpp:84
Scope (from outer to inner):
file
function void FOnlineIdentityFacebookCommon::ProfileRequest
Source code excerpt:
LoginUserRequests.Add(&HttpRequest.Get(), FPendingLoginUser(LocalUserNum, AccessToken));
FString FinalURL = MeURL.Replace(TEXT("`token"), *AccessToken, ESearchCase::IgnoreCase);
if (InProfileFields.Num() > 0)
{
FinalURL += FString::Printf(TEXT("&fields=%s"), *FString::Join(InProfileFields, TEXT(",")));
}
HttpRequest->OnProcessRequestComplete().BindRaw(this, &FOnlineIdentityFacebookCommon::MeUser_HttpRequestComplete, InCompletionDelegate);
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemFacebook/Source/Private/OnlineIdentityFacebookCommon.h:37
Scope (from outer to inner):
file
class class FOnlineIdentityFacebookCommon : public IOnlineIdentity
Source code excerpt:
FOnlineSubsystemFacebook* FacebookSubsystem;
/** URL for Facebook API to retrieve personal details */
FString MeURL;
/** Users that have been registered/authenticated */
FUserOnlineAccountFacebookMap UserAccounts;
/** Ids mapped to locally registered users */
TMap<int32, FUniqueNetIdPtr > UserIds;
public: