From 560e27532cd549a16e3b7cdc048ebc8d9dcad468 Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Tue, 25 Jan 2022 14:32:01 +0100 Subject: [PATCH] Replaced PSN auth request with a GetIdTokenRequest with the appropriate parameters. Still not quite working, some things aren't set up quite correctly yet in the backend. --- Assets/Scripts/EpicVoiceChatTest.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Assets/Scripts/EpicVoiceChatTest.cs b/Assets/Scripts/EpicVoiceChatTest.cs index 74a45c5..5de8984 100644 --- a/Assets/Scripts/EpicVoiceChatTest.cs +++ b/Assets/Scripts/EpicVoiceChatTest.cs @@ -56,7 +56,7 @@ public class EpicVoiceChatTest : MonoBehaviour private EOSVoiceChat voiceChat; private string xstsToken; - private string psnToken; + private string psnIdToken; private string XAudio29DllPath => #if UNITY_EDITOR @@ -260,15 +260,17 @@ public class EpicVoiceChatTest : MonoBehaviour #elif UNITY_PS4 || UNITY_PS5 var loggedInUser = PSInput.RefreshUsersDetails(0); - // TODO: this needs to be a GetIdTokenRequest with client ID, client secret and "openid id_token:basic_claims" as the scope - var request = new Authentication.GetAuthorizationCodeRequest + // Note: this requires a Presence2 service to be enabled on the game app and activated on the corresponding auth server. + // This auth server's client ID needs to be registered as an Identity Provider on the EOS portal. + var request = new Authentication.GetIdTokenRequest { UserId = loggedInUser.userId, ClientId = "83c6530f-741e-45ff-af3a-ddb90628a928", - Scope = "psn:s2s", + ClientSecret = "zvgUjFZ5edoiCYNV", + Scope = "openid id_token:basic_claims", }; - var requestOp = new AsyncRequest(request) + var requestOp = new AsyncRequest(request) .ContinueWith(antecedent => { if (antecedent?.Request == null || antecedent.Request.Result.apiResult != APIResultTypes.Success) @@ -279,19 +281,19 @@ public class EpicVoiceChatTest : MonoBehaviour } status.AppendLine("PSN authenticated"); - psnToken = antecedent.Request.AuthCode; + psnIdToken = antecedent.Request.IdToken; }); Authentication.Schedule(requestOp); - yield return new WaitUntil(() => !string.IsNullOrEmpty(psnToken)); + yield return new WaitUntil(() => !string.IsNullOrEmpty(psnIdToken)); connectInterface.Login(new Epic.OnlineServices.Connect.LoginOptions { Credentials = new Epic.OnlineServices.Connect.Credentials { Type = ExternalCredentialType.PsnIdToken, - Token = psnToken, + Token = psnIdToken, }, }, null, HandleConnectResult); #else