Hello Devs! My game is available on Steam and Epic Store and now I want to add user accounts (only Steam and EGS, I don’t want to force user to create new accounts). To store data I use backend server with Nakama.
Could you describe how should the user authentication flow look like?
What I have now:
Let user login:
FOnlineAccountCredentials OnlineAccountCredentials;
OnlineAccountCredentials.Type = "accountportal";
OnlineAccountCredentials.Id = "";
OnlineAccountCredentials.Token = "";
IdentityInterfacePtr->Login(0, OnlineAccountCredentials);
Then I have a delegate on login completed and I can get user AccessToken:
void UEOSHandleSubsystem::LoginCompleted(int numOfPlayers, bool bWasSuccessful, const FUniqueNetId& UserId, const FString& Error)
{
if(!IdentityInterfacePtr)
{return;}
TSharedPtr<FUserOnlineAccount> UserOnlineAccount = IdentityInterfacePtr->GetUserAccount(UserId);
FString AccessToken = UserOnlineAccount->GetAccessToken();
OnEOSLoginCompleted.Broadcast(bWasSuccessful, Error, AccessToken);
}
I can store the token in the backend Api, but how can I use this token so the user doesn’t need to login every time?
Thank you very much for all your answers!