question

PKM avatar image
PKM asked

How to get signature on LoginWithGameCenter?

I follow the link reply.

https://community.playfab.com/questions/40458/gamecenter-linking-fails-with-mysterious-error.html

but this code still not working.

How can i get signature code?

Social.localUser.Authenticate((bSuccess, msg) =>
                {
                    GameCenterSignature.Generate(OnSucceeded, OnFailed);
                });


[MonoPInvokeCallback(typeof(GameCenterSignature.OnSucceeded))]
    private static void OnSucceeded(string PublicKeyUrl, ulong timestamp, string signature, string salt, string playerID, string alias, string bundleID)
    {
        Debug.Log("Succeeded authorization to gamecenter: \n" +
            "PublicKeyUrl=" + PublicKeyUrl + "\n" +
            "timestamp=" + timestamp + "\n" +
            "signature=" + signature + "\n" +
            "salt=" + salt + "\n" +
            "playerID=" + playerID + "\n" +
            "alias=" + alias + "\n" +
            "bundleID=" + bundleID);


        var gamecenterRequest = new LoginWithGameCenterRequest()
        {
            PublicKeyUrl = PublicKeyUrl,
            Salt = salt,
            Signature = signature,
            Timestamp = timestamp.ToString(),
	    TitleId = PlayFabSettings.TitleId,
            PlayerId = playerID;
        };


	PlayFabClientAPI.LoginWithGameCenter(gamecenterRequest, result =>
                {
                    response.IsSucceeded = true;
                },
                error =>
                {
                });
     }
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

·
Sarah Zhang avatar image
Sarah Zhang answered

Could you please provide the specific error messages?

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

PKM avatar image PKM commented ·

signature does not match authentication request data

Thank you for checking.

0 Likes 0 ·
PKM avatar image PKM commented ·

The error is signature does not match authentication request data.

I think, PlayFabClientAPI.LoginWithGameCenter has error. Because i used another get signature code (https://gist.github.com/BastianBlokland/bbc02a407b05beaf3f55ead3dd10f808), Also got same error. Thank you

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang PKM commented ·

Thanks for the reply. Typically, this error means the signature doesn't match the salt, timestamp, bundleId or playerId. You can try to check whether they are correct one by one. The bundleId is the one you set in the PlayFab Add-ons page. It should be the same as the returned bundleID.

0 Likes 0 ·
PKM avatar image PKM Sarah Zhang commented ·

Thanks for the cheking. I don't know about correct salt, timestamp, signature and playerId. I just know bundleId. How can i check are they one by one? Also I already set Apple in PlayFab Add-ons. Please check and reply. Thank you.

0 Likes 0 ·
Show more comments
Show more comments
Sarah Zhang avatar image Sarah Zhang PKM commented ·

PlayFab uses the method under the Discussion of this documentation-- https://developer.apple.com/documentation/gamekit/gklocalplayer/1515407-generateidentityverificationsign to verify the signature. Could you please follow the method to verify if the hash value matches the signature parameter?

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.