Is it sdk bug or example code bug?
Condition
- Authentication 3.4.0
- Unity 6000.0.34f1
- Tested On: both MacOS and Windows Unity Editor
Sample Scene Name
- UnityPlayerAccountsUIExample
- Throws exception when click “sign in with unity” and signed in on that web page.
AuthenticationException: Invalid state for this operation. The player is already signing in.
Unity.Services.Authentication.PlayerAccounts.Samples.PlayerAccountsDemo.SignInWithUnity () (at Assets/Samples/Authentication/3.4.0/UI Example/PlayerAccountsDemo.cs:71)
UnityEngine.Debug:LogException(Exception)
Unity.Services.Authentication.PlayerAccounts.Samples.<SignInWithUnity>d__9:MoveNext() (at Assets/Samples/Authentication/3.4.0/UI Example/PlayerAccountsDemo.cs:77)
System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start(<SignInWithUnity>d__9&)
Unity.Services.Authentication.PlayerAccounts.Samples.PlayerAccountsDemo:SignInWithUnity()
Unity.Services.Authentication.PlayerAccounts.PlayerAccountServiceInternal:CompleteSignIn(SignInResponse) (at ./Library/PackageCache/com.unity.services.authentication/Player Accounts/Runtime/PlayerAccountServiceInternal.cs:264)
Unity.Services.Authentication.PlayerAccounts.<HandleSignInRequestAsync>d__60:MoveNext() (at ./Library/PackageCache/com.unity.services.authentication/Player Accounts/Runtime/PlayerAccountServiceInternal.cs:226)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult(SignInResponse)
Unity.Services.Authentication.PlayerAccounts.<SendAsync>d__15`1:MoveNext() (at ./Library/PackageCache/com.unity.services.authentication/Player Accounts/Runtime/Utilities/Network/WebRequest.cs:74)
System.Threading.Tasks.TaskCompletionSource`1:SetResult(String)
Unity.Services.Authentication.PlayerAccounts.WebRequest:RequestCompleted(TaskCompletionSource`1, Int64, Boolean, Boolean, String, String, IDictionary`2) (at ./Library/PackageCache/com.unity.services.authentication/Player Accounts/Runtime/Utilities/Network/WebRequest.cs:206)
Unity.Services.Authentication.PlayerAccounts.<>c__DisplayClass16_1:<SendAttemptAsync>b__0(AsyncOperation) (at ./Library/PackageCache/com.unity.services.authentication/Player Accounts/Runtime/Utilities/Network/WebRequest.cs:84)
UnityEngine.AsyncOperation:InvokeCompletionEvent() (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/AsyncOperation.cs:24)
class PlayerAccountsDemo : MonoBehaviour
{
async void SignInWithUnity()
{
try
{
// THROWS EXCEPTION
await AuthenticationService.Instance.SignInWithUnityAsync(PlayerAccountService.Instance.AccessToken);
m_ExternalIds = GetExternalIds(AuthenticationService.Instance.PlayerInfo);
UpdateUI();
}
catch (RequestFailedException ex)
{
Debug.LogException(ex);
SetException(ex);
}
}
}