Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all articles
Browse latest Browse all 8947

Nintendo Switch Authentication - ReturnCode: 32755 (Token invalid (format))

$
0
0
Hi, I’m hoping to get some help with our application which we are developing for Nintendo Switch.

I have just gone through the Switch stuff on the Nintendo site and got our application ID and we are at the Setup Complete stage. According to the forums posts and documentation I can find under Nintendo we have to be at that stage BEFORE we can get a valid Authentication Token.. so we’re there and I assume are good.
Next I created a Nintendo User, made them a Network User and used the Nintendo Membership Manager to authorise that user as a Nintendo Switch Online.
Have added the Nintendo Switch App ID to the Photon App that we have
I have set the Unity Publishing Settings App ID to the the same Nintendo Switch App ID.

So far so ‘seems’ good.

I am able to run through the calls using the Nintendo API to get the following lines of code to succeed:

result = nn.account.NetworkServiceAccount.EnsurIdTokenCacheAsync(context, account.Handle);

and then:

result = nn.account.NetworkServiceAccount.LoadIdTokenCache(ref tokenLength, tokenBuffer, account.Handle);

The 2nd line (above) was failing until I got into the SetupComplete phase of the OMAS2 application on the Nintendo site – prior to that I was using the default AppID for both.
The above line fills token buffer which is a byte[]
The sample SDSG code and documentation then suggests to add a null at the end, so they trim they token as below:

trimmedToken = new byte[tokenLength + 1];
Array.Copy(tokenBuffer, trimmedToken, (int)tokenLength);
trimmedToken[tokenLength] = 0;

Every things succeeds, that trimmedToken gets filled with data (I’m not sure what it should be, but it’s got something), so we then move on to the problem area, trying to Authenticate with Photon using that above byte[]

I then do:
PhotonNetwork.AuthValues = new AuthenticationValues();
PhotonNetwork.AuthValues.AuthType = CustomAuthenticationType.NintendoSwitch;
PhotonNetwork.AuthValues.AddAuthParameter("token", trimmedToken.ToString());

I seem to have to .ToString() it because the AuthParameter dictionary is string, string? But I fear that this is the issue.

I get the following error turned after calling PhotonNetwork.ConnectUsingSettings(gameVersion);

Operation failed: OperationResponse 230: ReturnCode: 32755 (Token invalid (format)). Parameters: {} Server: NameServer
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
NetworkingPeer:OnOperationResponse(OperationResponse)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(StreamBuffer)
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update()

Custom Authentication failed (either due to user-input or configuration or AuthParameter string format). Calling: OnCustomAuthenticationFailed()
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
NetworkingPeer:OnOperationResponse(OperationResponse)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(StreamBuffer)
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update()

Can anyone help me figure out what part of this I’m doing wrong or how I need to format that byte[] as I’m thinking that is the ‘invalid format’ that is returned.

Viewing all articles
Browse latest Browse all 8947

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>