PermissionsURL
PermissionsURL
#Overview
name: PermissionsURL
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 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of PermissionsURL is to store the URL used for requesting permissions from Facebook’s API in the Online Subsystem Facebook plugin for Unreal Engine 5. This variable is crucial for the online sharing functionality specifically related to Facebook integration.
The Online Subsystem Facebook plugin relies on this setting variable. It is used within the FOnlineSharingFacebookCommon class, which is part of the online sharing interface for Facebook.
The value of this variable is set from the configuration file (DefaultEngine.ini). It is read using the GConfig system, looking for the “PermissionsURL” key in the “OnlineSubsystemFacebook.OnlineSharingFacebook” section.
This variable interacts with other variables and systems:
- It’s used in conjunction with the API version (GetAPIVer()) from the Facebook subsystem.
- It’s combined with the user’s access token when making HTTP requests for permissions.
Developers must be aware of the following when using this variable:
- It must be properly set in the DefaultEngine.ini file.
- The URL should contain a placeholder (`ver) for the API version, which is replaced at runtime.
- It should also contain a placeholder (`token) for the user’s access token.
Best practices when using this variable include:
- Ensure the URL in the configuration file is up-to-date with Facebook’s API requirements.
- Handle cases where the URL might be empty or improperly formatted.
- Be prepared to handle HTTP request failures when using this URL.
- Regularly review and update the permissions URL to align with any changes in Facebook’s API or your app’s permission requirements.
- Implement proper error handling and logging, especially when the URL is missing from the configuration.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:2291, section: [OnlineSubsystemFacebook.OnlineSharingFacebook]
- INI Section:
OnlineSubsystemFacebook.OnlineSharingFacebook
- Raw value:
"https://graph.facebook.com/
ver/me/permissions?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/OnlineSharingFacebookCommon.cpp:158
Scope (from outer to inner):
file
function FOnlineSharingFacebookCommon::FOnlineSharingFacebookCommon
Source code excerpt:
: Subsystem(InSubsystem)
{
if (!GConfig->GetString(TEXT("OnlineSubsystemFacebook.OnlineSharingFacebook"), TEXT("PermissionsURL"), PermissionsURL, GEngineIni))
{
UE_LOG_ONLINE_SHARING(Warning, TEXT("Missing PermissionsURL= in [OnlineSubsystemFacebook.OnlineSharingFacebook] of DefaultEngine.ini"));
}
PermissionsURL.ReplaceInline(TEXT("`ver"), *InSubsystem->GetAPIVer());
CurrentPermissions.Setup();
IOnlineIdentityPtr IdentityInt = Subsystem->GetIdentityInterface();
check(IdentityInt.IsValid());
for (int32 i = 0; i < MAX_LOCAL_PLAYERS; i++)
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemFacebook/Source/Private/OnlineSharingFacebookCommon.cpp:206
Scope (from outer to inner):
file
function void FOnlineSharingFacebookCommon::RequestCurrentPermissions
Source code excerpt:
if (LocalUserNum >= 0 && LocalUserNum < MAX_LOCAL_PLAYERS)
{
if (!PermissionsURL.IsEmpty())
{
const FString AccessToken = Subsystem->GetIdentityInterface()->GetAuthToken(LocalUserNum);
if (!AccessToken.IsEmpty())
{
bStarted = true;
// kick off http request to get user info with the access token
FString FinalURL = PermissionsURL.Replace(TEXT("`token"), *AccessToken, ESearchCase::IgnoreCase);
TSharedRef<IHttpRequest, ESPMode::ThreadSafe> HttpRequest = FHttpModule::Get().CreateRequest();
HttpRequest->OnProcessRequestComplete().BindRaw(this, &FOnlineSharingFacebookCommon::Permissions_HttpComplete, LocalUserNum, CompletionDelegate);
HttpRequest->SetURL(FinalURL);
HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json"));
HttpRequest->SetVerb(TEXT("GET"));
#Loc: <Workspace>/Engine/Plugins/Online/OnlineSubsystemFacebook/Source/Private/OnlineSharingFacebookCommon.h:172
Scope (from outer to inner):
file
class class FOnlineSharingFacebookCommon : public IOnlineSharing
Source code excerpt:
FOnlineSubsystemFacebook* Subsystem;
/** Permissions request URL */
FString PermissionsURL;
/** Current state of granted/declined permissions */
FFacebookPermissions CurrentPermissions;
private:
/**