Authentication version 3.4.0 · November 28, 2024
Hello, I’m trying to use Code Link. It works fine in testing, I’m trying to figure out the polling method Code-Link
Doc just says:
Note: The SignInWithCodeAsync method also allows for automatic polling (every five seconds), so the device automatically signs the player in after the code has been authorized, or throws an exception if the code has expired. This method also accepts a CancellationToken to cancel the polling.
when I enable this option to true, I’m hit with this error on the first poll.
How is this method supposed to be used exactly? isn’t the point of polling so my Device B doesn’t have to click Confirm after their code was confirmed valid on Device A ?
Am I misunderstanding what polling supposed to do ?
[Authentication]: That is not a valid token (expected 3 parts but has 1).
UnityEngine.Logger:LogError (string,object)
Unity.Services.Authentication.Logger:LogError (object) (at ./Library/PackageCache/com.unity.services.authentication/Runtime/Utilities/Logger.cs:18)
Unity.Services.Authentication.JwtDecoder:Decode<Unity.Services.Authentication.AccessToken> (string) (at ./Library/PackageCache/com.unity.services.authentication/Runtime/Utilities/Jwt/JwtDecoder.cs:29)
Unity.Services.Authentication.AuthenticationServiceInternal:CompleteSignIn (string,string,bool,Unity.Services.Authentication.User,string) (at ./Library/PackageCache/com.unity.services.authentication/Runtime/AuthenticationServiceInternal.cs:339)
Unity.Services.Authentication.AuthenticationServiceInternal:CompleteSignIn (Unity.Services.Authentication.SignInResponse,bool) (at ./Library/PackageCache/com.unity.services.authentication/Runtime/AuthenticationServiceInternal.cs:332)
Unity.Services.Authentication.AuthenticationServiceInternal/<HandleSignInRequestAsync>d__127:MoveNext () (at ./Library/PackageCache/com.unity.services.authentication/Runtime/AuthenticationServiceInternal.cs:278)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start<Unity.Services.Authentication.AuthenticationServiceInternal/<HandleSignInRequestAsync>d__127> (Unity.Services.Authentication.AuthenticationServiceInternal/<HandleSignInRequestAsync>d__127&)
Unity.Services.Authentication.AuthenticationServiceInternal:HandleSignInRequestAsync (System.Func`1<System.Threading.Tasks.Task`1<Unity.Services.Authentication.SignInResponse>>,bool)
Unity.Services.Authentication.AuthenticationServiceInternal/<SignInWithCodeAsync>d__16:MoveNext () (at ./Library/PackageCache/com.unity.services.authentication/Runtime/AuthenticationServiceInternal.CodeLink.cs:73)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Authentication.SignInResponse>:SetResult (Unity.Services.Authentication.SignInResponse)
Unity.Services.Authentication.AuthenticationServiceInternal/<PollForCodeConfirmationAsync>d__17:MoveNext () (at ./Library/PackageCache/com.unity.services.authentication/Runtime/AuthenticationServiceInternal.CodeLink.cs:110)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Authentication.SignInResponse>:SetResult (Unity.Services.Authentication.SignInResponse)
Unity.Services.Authentication.WebRequest/<SendAsync>d__15`1<Unity.Services.Authentication.SignInResponse>:MoveNext () (at ./Library/PackageCache/com.unity.services.authentication/Runtime/Network/WebRequest.cs:66)
System.Threading.Tasks.TaskCompletionSource`1<string>:SetResult (string)
Unity.Services.Authentication.WebRequest:RequestCompleted (System.Threading.Tasks.TaskCompletionSource`1<string>,long,bool,bool,string,string,System.Collections.Generic.IDictionary`2<string, string>) (at ./Library/PackageCache/com.unity.services.authentication/Runtime/Network/WebRequest.cs:198)
Unity.Services.Authentication.WebRequest/<>c__DisplayClass16_0:<SendAttemptAsync>b__0 (UnityEngine.AsyncOperation) (at ./Library/PackageCache/com.unity.services.authentication/Runtime/Network/WebRequest.cs:76)
UnityEngine.AsyncOperation:InvokeCompletionEvent ()
And
Unity.Services.Core.RequestFailedException: Unknown error completing sign-in. ---> Unity.Services.Core.RequestFailedException: Failed to decode and verify access token.
at Unity.Services.Authentication.AuthenticationServiceInternal.CompleteSignIn (System.String accessToken, System.String sessionToken, System.Boolean enableRefresh, Unity.Services.Authentication.User user, System.String lastNotificationDate) [0x00010] in .\Library\PackageCache\com.unity.services.authentication\Runtime\AuthenticationServiceInternal.cs:342
--- End of inner exception stack trace ---
at Unity.Services.Authentication.AuthenticationServiceInternal.CompleteSignIn (System.String accessToken, System.String sessionToken, System.Boolean enableRefresh, Unity.Services.Authentication.User user, System.String lastNotificationDate) [0x00112] in .\Library\PackageCache\com.unity.services.authentication\Runtime\AuthenticationServiceInternal.cs:380
at Unity.Services.Authentication.AuthenticationServiceInternal.CompleteSignIn (Unity.Services.Authentication.SignInResponse response, System.Boolean enableRefresh) [0x00000] in .\Library\PackageCache\com.unity.services.authentication\Runtime\AuthenticationServiceInternal.cs:332
at Unity.Services.Authentication.AuthenticationServiceInternal.HandleSignInRequestAsync (System.Func`1[TResult] signInRequest, System.Boolean enableRefresh) [0x00096] in .\Library\PackageCache\com.unity.services.authentication\Runtime\AuthenticationServiceInternal.cs:283
at Unity.Services.Authentication.AuthenticationServiceInternal.SignInWithCodeAsync (System.Boolean usePolling, System.Threading.CancellationToken cancellationToken) [0x001ad] in .\Library\PackageCache\com.unity.services.authentication\Runtime\AuthenticationServiceInternal.CodeLink.cs:73
at Authentication.PollSignInWithCodeAsync () [0x00045] in P:\UNITY\Temp\AuthCodeSignIn\Assets\Authentication.cs:131
UnityEngine.Debug:Log (object)
Authentication/<PollSignInWithCodeAsync>d__21:MoveNext () (at Assets/Authentication.cs:135)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetException (System.Exception)
Unity.Services.Authentication.AuthenticationServiceInternal/<SignInWithCodeAsync>d__16:MoveNext () (at ./Library/PackageCache/com.unity.services.authentication/Runtime/AuthenticationServiceInternal.CodeLink.cs:79)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Authentication.SignInResponse>:SetResult (Unity.Services.Authentication.SignInResponse)
Unity.Services.Authentication.AuthenticationServiceInternal/<PollForCodeConfirmationAsync>d__17:MoveNext () (at ./Library/PackageCache/com.unity.services.authentication/Runtime/AuthenticationServiceInternal.CodeLink.cs:110)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<Unity.Services.Authentication.SignInResponse>:SetResult (Unity.Services.Authentication.SignInResponse)
Unity.Services.Authentication.WebRequest/<SendAsync>d__15`1<Unity.Services.Authentication.SignInResponse>:MoveNext () (at ./Library/PackageCache/com.unity.services.authentication/Runtime/Network/WebRequest.cs:66)
System.Threading.Tasks.TaskCompletionSource`1<string>:SetResult (string)
Unity.Services.Authentication.WebRequest:RequestCompleted (System.Threading.Tasks.TaskCompletionSource`1<string>,long,bool,bool,string,string,System.Collections.Generic.IDictionary`2<string, string>) (at ./Library/PackageCache/com.unity.services.authentication/Runtime/Network/WebRequest.cs:198)
Unity.Services.Authentication.WebRequest/<>c__DisplayClass16_0:<SendAttemptAsync>b__0 (UnityEngine.AsyncOperation) (at ./Library/PackageCache/com.unity.services.authentication/Runtime/Network/WebRequest.cs:76)
UnityEngine.AsyncOperation:InvokeCompletionEvent ()