Browse Source

Skip the Auth login step, which is only for linked Epic accounts. We can go straight to the Connect interface with our Xbox Live XSTS token.

master
Nico de Poel 5 years ago
parent
commit
cf2100a6df
  1. 40
      Assets/Scripts/MagnificentVoiceChat.cs

40
Assets/Scripts/MagnificentVoiceChat.cs

@ -203,18 +203,27 @@ public class MagnificentVoiceChat : MonoBehaviour
}
status.AppendLine("Xbox user added");
SDK.XUserGetTokenAndSignatureUtf16Async(userHandle, XUserGetTokenAndSignatureOptions.ForceRefresh,
SDK.XUserGetTokenAndSignatureUtf16Async(userHandle, XUserGetTokenAndSignatureOptions.None,
"GET", "https://api.epicgames.dev/", null, null, HandleTokenAndSignature);
});
yield return new WaitUntil(() => !string.IsNullOrEmpty(xstsToken));
#endif
connectInterface.Login(new Epic.OnlineServices.Connect.LoginOptions
{
Credentials = new Epic.OnlineServices.Connect.Credentials
{
Type = ExternalCredentialType.XblXstsToken,
Token = xstsToken,
},
}, null, HandleConnectResult);
#else
authInterface.Login(new LoginOptions
{
Credentials = GetEpicCredentials(),
ScopeFlags = AuthScopeFlags.BasicProfile,
}, null, HandleLoginResult);
#endif
}
#if UNITY_GAMECORE
@ -231,11 +240,9 @@ public class MagnificentVoiceChat : MonoBehaviour
status.AppendLine("Xbox Live successfully authenticated");
xstsToken = tokenAndSignature.Token;
}
#endif
private Credentials GetEpicCredentials() // This is platform-specific
#else
private Credentials GetEpicCredentials() // This is platform-specific (actually it's not, we can skip this on consoles)
{
#if UNITY_STANDALONE
return new Credentials
{
// Type = LoginCredentialType.AccountPortal, // Use ExternalAuth on console platform
@ -243,15 +250,6 @@ public class MagnificentVoiceChat : MonoBehaviour
Type = LoginCredentialType.Developer,
Token = SystemInfo.deviceName,
};
#elif UNITY_GAMECORE
return new Credentials
{
Type = LoginCredentialType.ExternalAuth,
ExternalType = ExternalCredentialType.XblXstsToken,
Token = xstsToken,
};
#elif UNITY_PS4 || UNITY_PS5
#endif
}
private void HandleLoginResult(LoginCallbackInfo data)
@ -268,20 +266,11 @@ public class MagnificentVoiceChat : MonoBehaviour
connectInterface.Login(new Epic.OnlineServices.Connect.LoginOptions
{
#if UNITY_STANDALONE
Credentials = new Epic.OnlineServices.Connect.Credentials
{
Type = ExternalCredentialType.Epic, // Can be XSTS or PSN ID as well, platform-specific
Token = token.AccessToken,
},
#elif UNITY_GAMECORE
Credentials = new Epic.OnlineServices.Connect.Credentials
{
Type = ExternalCredentialType.XblXstsToken, // Isn't this kinda redundant? Should we be logging in to our Epic account here?
Token = xstsToken,
},
#elif UNITY_PS4 || UNITY_PS5
#endif
}, null, HandleConnectResult);
break;
default:
@ -290,6 +279,7 @@ public class MagnificentVoiceChat : MonoBehaviour
break;
}
}
#endif
private void HandleConnectResult(Epic.OnlineServices.Connect.LoginCallbackInfo data)
{

Loading…
Cancel
Save