Authentication header for Swift iPhone application.

49 views
Skip to first unread message

Jay

unread,
Mar 7, 2016, 7:32:24 AM3/7/16
to LCP API Community

I'm currently working on iPhone application where I want to use points api to fetch the user miles. Could you please point me on documentation how to generate the Authorization header for Swift. I was trying "OAuthSwift" but no luck end up with error message, below are the complete logs 

Points + Data : {

https://sandbox.lcp.points.com/v1/lps/3b6a77e6-cb40-4b28-a146-341c5862fab6/mvs/

Points + Params : {

    authenticatingFactors =     {

        password = PASSWORD;

    };

    identifyingFactors =     {

        memberId = 2202;

    };

}

MAC ext="" id="29992b2a9bdb4159a75fe54b02491e7b" mac="pgX%2BPeMWgmME1ILZjHc%2FI3ezoTY%3D" nonce="F95E8D94" ts="1457352712"

Points + Data : {

    errors =     (

                {

            code = "BAD_REQUEST";

            description = "The application sent a request that this server could not understand.";

            field = "<null>";

        }

    );

}



Or Is there any example for iPhone application. Please help me to integrate the points api on my application.




Jeff Byrne

unread,
Mar 7, 2016, 10:25:53 AM3/7/16
to LCP API Community
Hi Jay,

Would you be able to provide the Correlation ID that was included in the response you received from the LCP? This would help us ensure that we're looking at the right entry in our logs.

From what we're seeing it looks like the request you sent did not have a valid JSON payload. For this example the payload needs to be as follows:

{
  "authenticatingFactors": {
    "password": "PASSWORD"
  },
  "identifyingFactors": {
    "memberId": "2202"
  }
}

Please let me know if you have any other questions.

Jeff Byrne
Product Manager, Loyalty Commerce Platform

Jay

unread,
Mar 7, 2016, 11:35:50 AM3/7/16
to LCP API Community


Hi Jeff, 


Thanks for your reply! and below are the details for api request 


▿ [Request]: <NSMutableURLRequest: 0x7fc440cdbd20> { URL: https://sandbox.lcp.points.com/v1/lps/3b6a77e6-cb40-4b28-a146-341c5862fab6/mvs/ }

[Response]: <NSHTTPURLResponse: 0x7fc440e60ee0> { URL: https://sandbox.lcp.points.com/v1/lps/3b6a77e6-cb40-4b28-a146-341c5862fab6/mvs/ } { status code: 400, headers {

    "Accept-Ranges" = bytes;

    Age = 0;

    "Cache-Control" = "no-cache";

    Connection = "keep-alive";

    "Content-Length" = 177;

    "Content-Type" = "application/json";

    Date = "Mon, 07 Mar 2016 15:50:42 GMT";

    "PTS-LCP-CID" = 314cb6a73f0447a0ba9b6c315a33fd0c;

    "PTS-LCP-Version" = "PROD - Platform Unified RC,2 - Package,228,e3ed9eb1c5dc";

    Server = "nginx/1.7.6";

    Via = "1.1 varnish";

    "X-Varnish" = 566855301;

Jeff Byrne

unread,
Mar 7, 2016, 4:02:15 PM3/7/16
to LCP API Community
Hi Jay,

Would you be able to provide the code you're using to generate the header and request?

Jeff Byrne
Product Manager, Loyalty Commerce Platform

Sandeep R

unread,
Mar 23, 2016, 6:42:18 AM3/23/16
to LCP API Community
Reply all
Reply to author
Forward
0 new messages