react-nativefacebookgigyaapple-id

Social login with AppleId or Facebook throws 401 error


Error object:

    {
  "code": "userCancelled",
  "message": "{\"callId\":\"a22e2c0a54fa40ef86e55161771cbb60\",\"statusCode\":201,\"errorCode\":401022,\"requestData\":\"ew0KICAiY2FsbElkIjogImEyMmUyYzBhNTRmYTQwZWY4NmU1NTE2MTc3MWNiYjYwIiwNCiAgImVycm9yQ29kZSI6IDQwMTAyMiwNCiAgImVycm9yTWVzc2FnZSI6ICJMb2dpbiBGYWlsZWQiLA0KICAiYXBpVmVyc2lvbiI6IDIsDQogICJzdGF0dXNDb2RlIjogNDAxLA0KICAic3RhdHVzUmVhc29uIjogIlVuYXV0aG9yaXplZCIsDQogICJ0aW1lIjogIjIwMjItMDYtMDdUMTc6MzU6NDIuNDI5WiIsDQogICJlcnJvckRldGFpbHMiOiAiNDAxMDIyIC0gTG9naW4gRmFpbGVkIg0KfQ==\",\"errorMessage\":\"Login Failed\"}",
  "name": "Error",
  "payload": {
    "apiVersion": 2,
    "callId": "a22e2c0a54fa40ef86e55161771cbb60",
    "errorCode": 401022,
    "errorDetails": "401022 - Login Failed",
    "errorMessage": "Login Failed",
    "statusCode": 401,
    "statusReason": "Unauthorized",
    "time": "2022-06-07T17:35:42.429Z"
  }

Trying to use https://github.com/colorfy-software/react-native-gigya-sdk for a social login. Using gmail and facebook web seems to work. But when trying to use AppleId or Facebook app the above error shows up.

Deps:

"react-native": "0.66.3", 
"react-native-gigya-sdk": "1.1.1",

Additional info added here: https://github.com/colorfy-software/react-native-gigya-sdk/issues/1


Solution

  • This generally indicates that the configuration is set up incorrectly.

    Make that the KeyID and private key are entered correctly on the Gigya dashboard.

    You have to create a key in your apple developer portal with the apple sign in capability and then download the key (keep it safe as the server removes it after downloading).

    See https://help.sap.com/docs/IDENTITY_AUTHENTICATION/6d6d63354d1242d185ab4830fc04feb1/fe6f7f0b39a74c03a807fa923a36f4e0.html?locale=en-US

    Put the KeyID value in the Gigya dashboard for Apple login configuration as well as the private key value which can be obtained by opening the keyID file in a text editor.