I’m stuck with the new Online Subsystem implementation in 4.16.1 for facebook and google. Login is not working by default. I am getting as far as FOnlineExternalUIFacebook::ShowLoginUI which attempts to trigger a delegate:
This is only necessary for desktop platforms. iOS and Android have their own implementations with their respective SDKs.
Desktop needs to use an integrated web browser to deliver user interaction. Including the “LoginFlow” module in the game build.cs is necessary as I’m sure you’ve discovered.
For the desktop, there is only a small bit of code to add. It is all contained below. The delegate will fire and hand the game a slate widget. You can slot that widget inside native Slate code, or wrap it in a UNativeNativeWidgetHost and pass it into your blueprint code if you choose.
// Initialize the login flow UI code
UWorld* World = GetWorld();
FName FacebookIdentifier = Online::GetUtils()->GetOnlineIdentifier(World, FACEBOOK_SUBSYSTEM);
FName GoogleIdentifier = Online::GetUtils()->GetOnlineIdentifier(World, GOOGLE_SUBSYSTEM);
ILoginFlowModule& LoginFlowModule = ILoginFlowModule::Get();
LoginFlowManager = LoginFlowModule.CreateLoginFlowManager();
if (!LoginFlowManager->AddLoginFlow(FacebookIdentifier, ILoginFlowManager::FOnDisplayPopup::CreateUObject(this, &ThisClass::OnDisplayLoginWidget)))
UE_LOG(LogWExp, Warning, TEXT("No Facebook subsystem configured. It will be unavailable"));
if (!LoginFlowManager->AddLoginFlow(GoogleIdentifier, ILoginFlowManager::FOnDisplayPopup::CreateUObject(this, &ThisClass::OnDisplayLoginWidget)))
UE_LOG(LogWExp, Warning, TEXT("No Google subsystem configured. It will be unavailable"));
MyGameClass::FOnPopupDismissed MyGameClass::OnDisplayLoginWidget(const TSharedRef<SWidget>& DisplayWidget)
// create a login flow UI which contains the slate widget or native host widget blueprint implementable
//return a FOnPopupDismissed delegate that the underlying system will call when the screen is closed for any reason.
// Widget dismissed by login flow or possibly game related Blueprint code
// For slate typically
// Blueprint callable if outer UI has way to shutdown login flow
Haven’t forgotten. Just busy internally. This code works in at least two of our internal projects. I’m engaging our support team to see if they can help repro this with a sample project.
The module is part of a plugin, so it is important that the .uplugin and .uproject setup are correct. Then including the module reference inside your top level game .build.cs file should be no big deal.
Other than debugging UnrealBuildTool.exe and putting a breakpoint inside the error that triggers, I’m not sure what the issue is at this point.
You can find the command line run in the build tool log files, or the NMake settings of Visual Studio.
I’m sorry to be difficult, but all of this stuff was working in 4.15. I upgraded my engine, and now it’s all broken. I’m doing my best to try to stay positive and assist you guys as much as I can to identify the issues and get them fixed.
I understand that Josh’s code was meant as a sample. I understand that there are no examples, and no documentation - which makes this process difficult. I’m doing my best to make it work.
I will take the time to write up a blog post with working code, to illustrate how this is actually done - once I can get it working.
Including OnlineSubsystemUtils.h FIXED ‘GetUtils’: is not a member of ‘Online’. Awesome. Thank you.
Next issue is another include that I can’t figure out:
Ok, after a lot of trial and error, I was able to get a bit further into the example code. Something I did also fixed the includes for ILoginFlowModule and ILoginFlowManager. Not exactly sure what it was.
I followed some other threads about how to get slate included. Which I think is required for FReply?
One line at a time, I suppose. Next up is this line:
if (!LoginFlowManager->AddLoginFlow(FacebookIdentifier, ILoginFlowManager::FOnDisplayPopup::CreateUObject(this, &AMyPlayerController::OnDisplayLoginWidget)))
Which errors out with:
Error (active) E0304 no instance of overloaded function “TBaseDelegate<WrappedRetValType, ParamTypes…>::CreateUObject [with WrappedRetValType=ILoginFlowManager::FOnPopupDismissed, ParamTypes=<const TSharedRef<SWidget, ESPMode::NotThreadSafe> &>]” matches the argument list Comp f:\Unreal Projects\Comp\Source\Comp\MyPlayerController.cpp 77
I created the OnDisplayLoginWidget like Josh’s example: