void UECROnlineSubsystem::Login(FString PlayerName, FString LoginType, FString Id, FString Token, bool bWantsCallback)
{
// Setting player display name
UserDisplayName = PlayerName;
// Login
if (OnlineSubsystem)
{
if (const IOnlineIdentityPtr OnlineIdentityPtr = OnlineSubsystem->GetIdentityInterface())
{
FOnlineAccountCredentials OnlineAccountCredentials;
OnlineAccountCredentials.Id = Id;
OnlineAccountCredentials.Token = Token;
OnlineAccountCredentials.Type = LoginType;
if (bWantsCallback)
{
OnlineIdentityPtr->OnLoginCompleteDelegates->AddUObject(this, &UECROnlineSubsystem::OnLoginComplete);
}
OnlineIdentityPtr->Login(0, OnlineAccountCredentials);
}
}
}
Then I usually login via accountportal
Login(PlayerName, "accountportal");
But in logs I see that access token works only for 2 hours. After that the game usually freezes.
LogEOSAuth: NewUserToken: User ClientId: ... AccountId: .... Access[Expires: 2023.05.10-20.41.16 Remaining: 7200.71] Refresh[Expires: 2023-11-06T18:41:16.715Z Remaining: 15552000.71] State: Valid
…
[2023.05.10-19.40.15:439][120]LogOnline: Error: EOS: ConnectLoginNoEAS(0) failed due to no platform OSS [2023.05.10-19.40.15:439][120]LogOnline: Error: EOS: ConnectLoginNoEAS(0) failed due to the platform OSS giving an empty auth token
How can I use the refresh token to update the access token with the OnlineSubsystem? Or maybe it should be done automatically then why it doesn’t happen?
Config is
[/Script/OnlineSubsystemEOS.EOSSettings]
CacheDir = CacheDir
DefaultArtifactName = DefaultArtifact
TickBudgetInMilliseconds = 0
bEnableOverlay = False
bEnableSocialOverlay = False
bShouldEnforceBeingLaunchedByEGS = False
TitleStorageReadChunkLength = 0
+Artifacts = (ArtifactName="DefaultArtifact",ClientId="...",ClientSecret="....",ProductId="....",SandboxId="...",DeploymentId="....",EncryptionKey="...")
bUseEAS = False
bUseEOSConnect = False
bMirrorStatsToEOS = False
bMirrorAchievementsToEOS = False
bUseEOSSessions = False
bMirrorPresenceToEAS = False
[OnlineSubsystemEOS]
bEnabled=true
[OnlineSubsystem]
DefaultPlatformService=EOS
[/Script/Engine.GameEngine]
+NetDriverDefinitions = (DefName="GameNetDriver",DriverClassName="OnlineSubsystemEOS.NetDriverEOS",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
[/Script/OnlineSubsystemEOS.NetDriverEOS]
bIsUsingP2PSockets=true