Paypal OATH2 problem. WWW Error: The operation couldn’t be completed. (NSURLErrorDomain error -1012.)

I get this error when I getting accestoken from Paypal. I cant figure out.

I got this answer I tried with postman ....

->

{

"scope": "https://uri.paypal.com/services/subscriptionshttps://api.paypal.com/v1/payments/.*https://api.paypal.com/v1/vault/credit-cardhttps://uri.paypal.com/services/applications/webhooks openid https://uri.paypal.com/payments/payoutshttps://api.paypal.com/v1/vault/credit-card/.*",

"nonce": "2017-07-23T18:01:48ZW_QkOhvCFyNAYpuVC5Vs9_TvysT8726foWfGwyzqyts",

"access_token": "A21AAFlB7OYoqsyl3stgWz8UEACMcDOa3NNbkW-7jQNusy1It50D_xg1S8bM7Hc9Tp7KyeNfzuYPP84Ixx4D0XG4BGWy4HOBA",

"token_type": "Bearer",

"app_id": "APP-80W284485P519543T",

"expires_in": 32382

}

It works again when I post another https adress .

What these error codes really mean.{error code: -999 [1:89] and NSURLErrorDomain error -1012.}

HTTP load failed (error code: -999 [1:89]) for Task <86785AD5-6827-406B-8A86-4083FB6D8F7D>.<0>

WWW Error: The operation couldn’t be completed. (NSURLErrorDomain error -1012.)

UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)

UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])

UnityEngine.Debug:LogException(Exception)

UnityEngine.Logger:Log(LogType, Object)

System.Collections.ObjectModel.Collection`1:Remove(T)

UnityEngine.Debug:Log(Object)

<MakePayAPIcall>c__Iterator0:MoveNext()

UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)


You can test with clientID and secret


string clientID = "AQ9Kk0CAdIwFn5bqZYrROXEkndbS-thNvaQOR4rP3p6tgLWaUKpxKuH3Gu6DCCJX5iiymtnB8BwUFEzz";

string secret = "ECgdXh-psaoJtEjNvUIOuYP1HXIBGBS4z4SroRLyb-021Jh91EDtuAXU8IlLYFXPf-gB1wAr6phF2sve";


Unity Sample CODE;



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

headers.Add("Accept","application/json");
headers.Add("Accept-Language","en_US");
headers.Add("Authorization","Basic " + System.Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes( clientID + ":" + secret)));

WWWForm postData = new WWWForm();

postData.AddField("grant_type", "client_credentials");

string endpointURL = StoreProperties.INSTANCE.isUsingSandbox () ?
"https:/ "https:/
WWW www = new WWW(endpointURL, postData.data,headers);

Debug.Log("Making call to: " + endpointURL);

yield return www;

Replies

What these error codes really mean.{error code: -999 [1:89] and NSURLErrorDomain error -1012.}

You can find these errors in

<Foundation/NSURLError.h>
, to wit:
  • -999 is

    NSURLErrorCancelled
  • -1012 is

    NSURLErrorUserCancelledAuthentication

I don’t know anything about PayPal or Unity, so I can’t offer any input on those fronts.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Did you find any solution?