# Cant return EOS Friends list? 

**URL:** <https://forums.unrealengine.com/t/cant-return-eos-friends-list/2858205>\
**Category:** Multiplayer\
**Tags:** epic-online-services, question\
**Created:** [February 1, 2025, 3:02am UTC](https://forums.unrealengine.com/t/cant-return-eos-friends-list/2858205 "2025-02-01T03:02:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [February 1, 2025, 3:02am UTC](https://forums.unrealengine.com/t/cant-return-eos-friends-list/2858205/1 "2025-02-01T03:02:52Z")

</div>

Hello! I have been trying to integrate EOS in my project and make a friend list system, I am currently working on retrieving my friends list by clicking a button. I believe I have the right code since im following a tutorial and no one that has followed seems to have issues with it, that being said it was done 3 years ago and things might be different now.

The issue im having is that the code seems to fire all the UELOGs until it reaches the OnGetAllFriendsComplete, that doest seem to ever fire, as the first UELOG in that void never fires. I have tried verifying if its null and if its not valid, but that doesnt seem to be the problem as I never receive the “UE\_LOG(LogTemp, Error, TEXT(“Friends Interface is NULL! Online Subsystem may not support friends.”));” message. Any ideas of what im doing wrong? Maybe a setup issue?

Many thanks!

PS: I have a basic blueprint that fires on button click and it does actually trigger all these voids, but the functionality never seems to fire.

 ![BP](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/e/6/8e68fa3358e33c573feed921b0aa668c13645299.png)

Im attaching the .CPP and the .h file here:

.cpp:

```auto
// Fill out your copyright notice in the Description page of Project Settings.

#include "EOSGameInstance.h"

#include "Interfaces/OnlineSessionInterface.h"
#include "Interfaces/OnlineIdentityInterface.h"
#include "Interfaces/OnlineFriendsInterface.h"
#include "OnlineSessionSettings.h"
#include "OnlineSubsystem.h"
#include "OnlineSessionSettings.h"

const FName ConstSessionName = FName("TestSession");

UEOSGameInstance::UEOSGameInstance()
{
	bIsLoggedIn = false;
}

void UEOSGameInstance::Init()
{
	Super::Init();

	OnlineSubsystem = IOnlineSubsystem::Get();
	Login();
}

void UEOSGameInstance::Login()
{
	if (OnlineSubsystem)
	{
		if (IOnlineIdentityPtr Identity = OnlineSubsystem->GetIdentityInterface())
		{
			FOnlineAccountCredentials Credentials;
			Credentials.Id = FString("127.0.0.1:7777");
			Credentials.Token= FString("Admin");
			Credentials.Type = FString("developer");

			Identity->OnLoginCompleteDelegates->AddUObject(this, &UEOSGameInstance::OnLoginComplete);
			Identity->Login(0, Credentials);
		}
	}
}

void UEOSGameInstance::OnLoginComplete(int32 LocalUserNum, bool bWasSuccessful, const FUniqueNetId& UniqueId,
	const FString& Error)
{
	UE_LOG(LogTemp, Warning, TEXT("Logged In: %d"), bWasSuccessful);
	 bIsLoggedIn = bWasSuccessful;

	if (OnlineSubsystem)
	{
		if (IOnlineIdentityPtr Identity = OnlineSubsystem->GetIdentityInterface())
		{
			Identity->ClearOnLoginCompleteDelegates(0, this);
		}
	}
}

void UEOSGameInstance::CreateSession()
{
	if (bIsLoggedIn)
	{
		if (OnlineSubsystem)
		{
			if (IOnlineSessionPtr SessionPtr = OnlineSubsystem->GetSessionInterface())
			{
				FOnlineSessionSettings SessionSettings;

				// Session config, change this for Dedicated Server (Also change DefaultEngine.ini P2PSocket to False)
				SessionSettings.bIsDedicated = false;
				SessionSettings.bShouldAdvertise = true;
				SessionSettings.bIsLANMatch = false;
				SessionSettings.NumPublicConnections = 5;
				SessionSettings.bAllowJoinInProgress = true;
				SessionSettings.bAllowJoinViaPresence = true;
				SessionSettings.bUsesPresence = true;
				SessionSettings.bUseLobbiesIfAvailable = true;
				SessionSettings.Set(FName(TEXT("SEARCH_KEYWORDS")), FString("BBS_RebootLobby"), EOnlineDataAdvertisementType::ViaOnlineService);

				SessionPtr->OnCreateSessionCompleteDelegates.AddUObject(this, &UEOSGameInstance::OnCreateSessionComplete);
				SessionPtr->CreateSession(0, ConstSessionName, SessionSettings);
			}
		}
	}
	else
	{
		UE_LOG(LogTemp, Error, TEXT("Cannot create session: Not logged in"));
	}
}

void UEOSGameInstance::OnCreateSessionComplete(FName SessionName, bool bWasSuccessful)
{
	UE_LOG(LogTemp, Warning, TEXT("Success: %d"), bWasSuccessful);
	if (OnlineSubsystem)
	{
		if (IOnlineSessionPtr SessionPtr = OnlineSubsystem->GetSessionInterface())
		{
			SessionPtr->ClearOnCreateSessionCompleteDelegates(this);
		}
	}
}

void UEOSGameInstance::DestroySession()
{
	if (bIsLoggedIn)
	{
		if (OnlineSubsystem)
		{
			if (IOnlineSessionPtr SessionPtr = OnlineSubsystem->GetSessionInterface())
			{
				SessionPtr->OnDestroySessionCompleteDelegates.AddUObject(this, &UEOSGameInstance::OnDestroySessionComplete);
				SessionPtr->DestroySession(ConstSessionName);
			}
		}
	}
}

void UEOSGameInstance::OnDestroySessionComplete(FName SessionName, bool bWasSuccessful)
{
	if (OnlineSubsystem)
	{
		if (IOnlineSessionPtr SessionPtr = OnlineSubsystem->GetSessionInterface())
		{
			SessionPtr->ClearOnDestroySessionCompleteDelegates(this);
		}
	}
}

void UEOSGameInstance::GetAllFriends()
{
	UE_LOG(LogTemp, Warning, TEXT("Friends list button pressed"));
	if (bIsLoggedIn)
	{
		UE_LOG(LogTemp, Warning, TEXT("Logged in"));
		if (OnlineSubsystem)
		{
			UE_LOG(LogTemp, Warning, TEXT("Online Subsystem active"));
			if(IOnlineFriendsPtr FriendsPtr = OnlineSubsystem->GetFriendsInterface())
			{
				FriendsPtr->ReadFriendsList(0, FString (""), FOnReadFriendsListComplete::CreateUObject(this, &UEOSGameInstance::OnGetAllFriendsComplete));
				UE_LOG(LogTemp, Warning, TEXT("Getting Friends Interface"));
				if (!FriendsPtr.IsValid())
				{
					UE_LOG(LogTemp, Error, TEXT("Friends Interface is NULL! Online Subsystem may not support friends."));
					return;
				}
			}
		}
	}
}

void UEOSGameInstance::OnGetAllFriendsComplete(int32 LocalUserNum, bool bWasSuccessful, const FString& ListName,
	const FString& ErrorStr)
{
	UE_LOG(LogTemp, Warning, TEXT("Friends list completed"));
	if (bWasSuccessful)
	{
		UE_LOG(LogTemp, Warning, TEXT("Friends list was successful"));
		if (OnlineSubsystem)
		{
			UE_LOG(LogTemp, Warning, TEXT("Online subsystem active 2"));
			if(IOnlineFriendsPtr FriendsPtr = OnlineSubsystem->GetFriendsInterface())
			{
				UE_LOG(LogTemp, Warning, TEXT("Friend list interface achieved"));
				TArray<TSharedRef<FOnlineFriend>> FriendsList;
				if(FriendsPtr->GetFriendsList(0, ListName, FriendsList))
				{
					UE_LOG(LogTemp, Warning, TEXT("Friends list adquired"));
					for (TSharedRef<FOnlineFriend> Friend : FriendsList)
					{
						UE_LOG(LogTemp, Warning, TEXT("Looping..."));
						FString FriendName = Friend.Get().GetRealName();
						UE_LOG(LogTemp, Warning, TEXT("Friend Name: %s"), *FriendName);
					}
				}
			}
		}
	}
}

```

.h:

```auto
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Engine/GameInstance.h"
#include "EOSGameInstance.generated.h"

/**
 *
 */
UCLASS()
class BBS_REBOOT_API UEOSGameInstance : public UGameInstance
{
	GENERATED_BODY()

public:
	UEOSGameInstance();

	virtual void Init() override;

	void Login();
	void OnLoginComplete(int32 LocalUserNum, bool bWasSuccessful, const FUniqueNetId& UserId, const FString& Error);

	UFUNCTION(BlueprintCallable)
	void CreateSession();
	void OnCreateSessionComplete(FName SessionName, bool bWasSuccessful);

	UFUNCTION(BlueprintCallable)
	void DestroySession();
	void OnDestroySessionComplete(FName SessionName, bool bWasSuccessful);

	UFUNCTION(BlueprintCallable)
	void GetAllFriends();
	void OnGetAllFriendsComplete(int32 LocalUserNum, bool bWasSuccessful, const FString& ListName, const FString& ErrorStr);

protected:
	class IOnlineSubsystem* OnlineSubsystem;

	bool bIsLoggedIn;
};

```

---

<div class="post-metadata">

**Author:** ![SebBergy2.0](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sebbergy2.0/32/1214708_2.png) [@SebBergy2.0](https://forums.unrealengine.com/u/SebBergy2.0)\
**Post date:** [June 19, 2025, 2:41pm UTC](https://forums.unrealengine.com/t/cant-return-eos-friends-list/2858205/2 "2025-06-19T14:41:29Z")

</div>

Hey, sorry for the delay here. Are you sure the OnlineSubsystemEOS is getting initialized correctly? I’d recommend checking the EOS SDK logs. Unrelated side-note, you may want to move your code to different class(es) than a derived UGameInstance.
