question

holden.profit@run-games.com avatar image
holden.profit@run-games.com asked

LoginWithGameCenter 500 Internal Server Error

After having logged my player into GameCenter and verifying that they are authenticated, I am trying to log that player into PlayFab using the iOS SDK's LoginWithGameCenter method.

[[GKLocalPlayer localPlayer] generateIdentityVerificationSignatureWithCompletionHandler:^  (NSURL * a_pPublicKeyUrl, NSData * a_pSignature, NSData * a_pSalt, uint64_t a_Timestamp, NSError * a_pError)
    {
        if (a_pError)
        {
            // ... Log Error
            return;
        }
        
        const char* pszGameCenterID = "<Player's GCID>"


        ClientLoginWithGameCenterRequest* login_request = [ClientLoginWithGameCenterRequest new];
        login_request.PlayerId = [NSString stringWithUTF8String:pszGameCenterID];
        login_request.CreateAccount = true; //creates a new account if no existing one
        login_request.PublicKeyUrl = a_pPublicKeyUrl.absoluteString;
        login_request.Salt = [[[NSString alloc] initWithData:a_pSalt encoding:NSASCIIStringEncoding] autorelease];
        login_request.Signature = [[[NSString alloc] initWithData:a_pSignature encoding:NSASCIIStringEncoding] autorelease];
        login_request.Timestamp = [NSString stringWithFormat:@"%lld", a_Timestamp];
        
        [[PlayFabClientAPI GetInstance] LoginWithGameCenter:login_request
            success:^(ClientLoginResult* result, NSObject* userData) {
                // ... Handle Success
            }
            failure:^(PlayFabError *error, NSObject *userData) {
                // ... Handle Error
            } withUserData:nil];
    }];

Every time I attempt to log in, I get a 500 error with error code 1110 marked as an InternalServerError with "An unexpected error occured while processing the request." for the error message.

I'm wondering if anyone else is having this issue or knows a solution? Perhaps we're missing something in our configuration?

apis
10 |1200

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

1 Answer

·
Citrus Yan avatar image
Citrus Yan answered

May I know your title id? And if you don't mind, please also provide a sample request of yours for us to reproduce the issue from our side. BTW, I noticed that you didn't specify the titleid in the request, which is required in the request body.

4 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.

holden.profit@run-games.com avatar image holden.profit@run-games.com commented ·

Title ID: B55A0
Title ID gets added to the request body itself within the LoginWithGameCenter method (line 3972 of PlayFabClientAPI.m) which comes from PlayFabSettings.m line 15)

GameCenter ID: U:66ffe914ecebf9ba2fa6482f36d5921c_PRO2020

CreateAccount: True
Public Key URL: "https://static.gc.apple.com/public-key/3rd-party-auth-prod-19824d.cer"

The signature is rather lengthy and the salt is randomized I believe. Do you need any additional information to repro?

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan holden.profit@run-games.com commented ·

Just tested with the parameters you provided and it work fine in my test title, I suspect there maybe something wrong with the signature you put in the request, could you please check on that?

BTW, did you check the "Require secure authentication only for this app" box on the Apple Add-ons page in the PlayFab Game Manager?

0 Likes 0 ·
apple-add-on.png (9.3 KiB)
holden.profit@run-games.com avatar image holden.profit@run-games.com Citrus Yan commented ·

Success! Changing the encoding for the Signature worked.

That option on the Apple Add-on is not checked, no. I changed the encoding used for the Signature:

// Previously was
pLoginRequest.Signature = [[[NSString alloc] initWithData:a_pSignature encodinga:NSASCIIStringEncoding] autorelease];

// Now is pLoginRequest.Signature = [[NSString alloc] initWithData:a_pSignature encoding:NSUTF8StringEncoding];
0 Likes 0 ·
Show more comments

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.