question

playeveryware-tom avatar image
playeveryware-tom asked

LoginWithNintendoSwitchDeviceId response gets ServiceUnavailable/BadRequest

Hello,

For our Unity project we are porting to Switch, whenever we try to login using LoginWithNintendoSwitchDeviceId, we get the following response:

/Client/LoginWithNintendoSwitchDeviceId PlayFabError(ServiceUnavailable, Cannot resolve destination host, 400 BadRequest)

I've not been able to figure out a way to debug this error. As far as I can tell, there shouldn't be any reason that the host unreachable (no firewall or internet network settings, internet/wifi settings are configured on the devkit, etc). The title id is also configured in the PlayFab settings file. My guess might be that this is an authentication issue due to us missing some step in configuring everything, but the error code/message doesn't actually indicate that.

Here is the code we are using to login. Does anyone have any ideas on what we could try next to debug this issue? We're running up against the clock unfortunately, which means we may have to resort to shipping without leaderboards on Switch.

nn.account.NetworkServiceAccountId networkAccountId = GetNetworkId(Switch_FsSaveData.UserHandle);
string internalID = networkAccountId.ToString();

var request = new LoginWithNintendoSwitchDeviceIdRequest
{
    NintendoSwitchDeviceId = internalID,
    CreateAccount = true,
};
Log("Logging in with userid: " + internalID);
PlayFabClientAPI.LoginWithNintendoSwitchDeviceId(request, OnLoginSucc, OnLoginErr);
Leaderboards and StatisticsAuthentication
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Seth Du avatar image Seth Du ♦ commented ·

Have you check this thread? https://community.playfab.com/questions/24083/serviceunavailablecannot-resolve-destination-host.html Make sure network permission is granted.

0 Likes 0 ·
playeveryware-tom avatar image playeveryware-tom commented ·

I think this might be the Switch operating system preventing/blocking any http requests to an independent server until we have gotten the network service account's ID token.

I'm going through some other Nintendo Switch sample projects to understand the authentication flow. I'm now trying to call "EnsurIdTokenCacheAsync" (EnsureNetworkServiceAccountIdTokenCacheAsync) before doing the PlayFab login http request, the operation fails.

I think that this means that we aren't able to contact a independent server in a game using the Application ID generated by Nintendo, until any independent server has been approved for the game in OMAS. Does that sound correct? Has anyone worked on or tested PlayFab features on Switch to verify this?

Does anyone have any sample code for logging into to Switch that includes the rest of the Switch specific APIs that are required/prerequisites for doing the PlayFab login call?

0 Likes 0 ·

1 Answer

·
Andy avatar image
Andy answered

I'm not 100% sure, and can't share much here due to Nintendo NDA considerations. You might want to check out this documentation on Nintendo's developer portal, though: https://developer.nintendo.com/html/online-docs/g1kr9vj6-en/Packages/Docs/Manuals/NX-IndependentServerSetupManual/contents/Pages/Page_113812328.html.

It covers the processes and requirements for connecting to an external server from a Switch.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image brendan commented ·

For the sake of others running into this, here's a list of things to check (if you need the details on the acronyms, please visit the Nintendo developer portal - those details can't be provided in a public forum):

1. Check that you're signed into an NSA.

2. Check that "Initialize NIFM" and "Initialize Sockets" are selected in your settings.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.