question

digitalmkt avatar image
digitalmkt asked

OpenIDConnection Value cannot be null.\r\nParameter name: key

I've been trying to solve an issue when LoginWithOpenIdConnection api. Tested in the app and in postman the error is the same: "Value cannot be null.\r\nParameter name: key". I'm using the SigninWithApple unity plugin that is working fine and the login is successful but when I try to log in with OpenID to play fab I have this error. The code I'm using is:

 public void Playfablogin()

        {


            Dictionary<string, string> keys = new Dictionary<string, string>();

            keys.Add("key", "Itunes App key"); //is this correct?



            Debug.Log("key:" + keys ["key"]);

            Debug.Log("Starting Apple Login.");

            var loginRequest = new LoginWithOpenIdConnectRequest

            {

                ConnectionId = "com.passportar.spain",

                CreateAccount = true,

                IdToken = PlayerPrefs.GetString("appleidtoken"),

                TitleId = "67BE",



            };



            //var key = infoRequestParams.TitleDataKeys;

            //settings.Add { "key", ""}

            PlayFab.PlayFabClientAPI.LoginWithOpenIdConnect(loginRequest, appleLoginSucess, appleLoginError, keys["key"]);



        }

The error from postman is the following:

{
    "code": 403,
    "status": "Forbidden",
    "error": "NotAuthorized",
    "errorCode": 1089,
    "errorMessage": "Value cannot be null.\r\nParameter name: key"
}

This is the XCODE error via debug.log:

Error Report: /Client/LoginWithOpenIdConnect: Value cannot be null.


Parameter name: key
UnityEngine.SignInWithApple.SignInWithApple:appleLoginError(PlayFabError)
System.Action`1:Invoke(T)
PlayFab.Internal.PlayFabUnityHttp:OnResponse(String, CallRequestContainer)
PlayFab.Internal.<Post>d__12:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

I also did the setup in the Game Manager Apple Set Setup:

And the OpenID Connect:

What exactly this mean? have an example code showing how to solve this?

Thank you very much.

Authentication
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

There is not an official example code about using apple with PlayFab's OpenID integration. Your configuration and request body looks correct. In our previous test, the keys[“key”] in this line is not needed.

PlayFab.PlayFabClientAPI.LoginWithOpenIdConnect(loginRequest, appleLoginSucess, appleLoginError, keys["key"]);

You can try to modify it to “PlayFab.PlayFabClientAPI.LoginWithOpenIdConnect(loginRequest, appleLoginSucess, appleLoginError);” and test it again.

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

digitalmkt avatar image digitalmkt commented ·

Hi Sarah, Thanks for your answer. I tried what you suggested but the error still and now I've got the "Not Authorized"

Postman:

{
    "code": 403,
    "status": "Forbidden",
    "error": "NotAuthorized",
    "errorCode": 1089,
    "errorMessage": "Value cannot be null.\r\nParameter name: key"
}

Xcode:

PlayFab Apple Login error: Value cannot be null.


Parameter name: key
UnityEngine.SignInWithApple.SignInWithApple:appleLoginError(PlayFabError)
System.Action`1:Invoke(T)
PlayFab.Internal.PlayFabUnityHttp:OnResponse(String, CallRequestContainer)
PlayFab.Internal.<Post>d__12:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
 
(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)


PlayFab Apple Login error: NotAuthorized
UnityEngine.SignInWithApple.SignInWithApple:appleLoginError(PlayFabError)
System.Action`1:Invoke(T)
PlayFab.Internal.PlayFabUnityHttp:OnResponse(String, CallRequestContainer)
PlayFab.Internal.<Post>d__12:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

Thank you very much.

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

Sorry for the late reply. The parameter "key" should from another place. But currently, we lack a MacOs development environment, so we can not test it immediately. We will inform you if we have any progress. In addition, you can try to use PlayFab new API LoginWithApple to handle such "Sign in with Apple" questions.

1 Like 1 ·
digitalmkt avatar image digitalmkt Sarah Zhang commented ·

Ok. Thanks. I'll try it.

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.