|
|
@ -203,18 +203,27 @@ public class MagnificentVoiceChat : MonoBehaviour |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
status.AppendLine("Xbox user added"); |
|
|
status.AppendLine("Xbox user added"); |
|
|
SDK.XUserGetTokenAndSignatureUtf16Async(userHandle, XUserGetTokenAndSignatureOptions.ForceRefresh, |
|
|
|
|
|
|
|
|
SDK.XUserGetTokenAndSignatureUtf16Async(userHandle, XUserGetTokenAndSignatureOptions.None, |
|
|
"GET", "https://api.epicgames.dev/", null, null, HandleTokenAndSignature); |
|
|
"GET", "https://api.epicgames.dev/", null, null, HandleTokenAndSignature); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
yield return new WaitUntil(() => !string.IsNullOrEmpty(xstsToken)); |
|
|
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 |
|
|
authInterface.Login(new LoginOptions |
|
|
{ |
|
|
{ |
|
|
Credentials = GetEpicCredentials(), |
|
|
Credentials = GetEpicCredentials(), |
|
|
ScopeFlags = AuthScopeFlags.BasicProfile, |
|
|
ScopeFlags = AuthScopeFlags.BasicProfile, |
|
|
}, null, HandleLoginResult); |
|
|
}, null, HandleLoginResult); |
|
|
|
|
|
#endif
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#if UNITY_GAMECORE
|
|
|
#if UNITY_GAMECORE
|
|
|
@ -231,11 +240,9 @@ public class MagnificentVoiceChat : MonoBehaviour |
|
|
status.AppendLine("Xbox Live successfully authenticated"); |
|
|
status.AppendLine("Xbox Live successfully authenticated"); |
|
|
xstsToken = tokenAndSignature.Token; |
|
|
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 |
|
|
return new Credentials |
|
|
{ |
|
|
{ |
|
|
// Type = LoginCredentialType.AccountPortal, // Use ExternalAuth on console platform
|
|
|
// Type = LoginCredentialType.AccountPortal, // Use ExternalAuth on console platform
|
|
|
@ -243,15 +250,6 @@ public class MagnificentVoiceChat : MonoBehaviour |
|
|
Type = LoginCredentialType.Developer, |
|
|
Type = LoginCredentialType.Developer, |
|
|
Token = SystemInfo.deviceName, |
|
|
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) |
|
|
private void HandleLoginResult(LoginCallbackInfo data) |
|
|
@ -268,20 +266,11 @@ public class MagnificentVoiceChat : MonoBehaviour |
|
|
|
|
|
|
|
|
connectInterface.Login(new Epic.OnlineServices.Connect.LoginOptions |
|
|
connectInterface.Login(new Epic.OnlineServices.Connect.LoginOptions |
|
|
{ |
|
|
{ |
|
|
#if UNITY_STANDALONE
|
|
|
|
|
|
Credentials = new Epic.OnlineServices.Connect.Credentials |
|
|
Credentials = new Epic.OnlineServices.Connect.Credentials |
|
|
{ |
|
|
{ |
|
|
Type = ExternalCredentialType.Epic, // Can be XSTS or PSN ID as well, platform-specific
|
|
|
Type = ExternalCredentialType.Epic, // Can be XSTS or PSN ID as well, platform-specific
|
|
|
Token = token.AccessToken, |
|
|
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); |
|
|
}, null, HandleConnectResult); |
|
|
break; |
|
|
break; |
|
|
default: |
|
|
default: |
|
|
@ -290,6 +279,7 @@ public class MagnificentVoiceChat : MonoBehaviour |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
private void HandleConnectResult(Epic.OnlineServices.Connect.LoginCallbackInfo data) |
|
|
private void HandleConnectResult(Epic.OnlineServices.Connect.LoginCallbackInfo data) |
|
|
{ |
|
|
{ |
|
|
|