s26761

Problem with getting token for authentication

Discussion created by s26761 on Oct 2, 2012
Latest reply on Jan 28, 2013 by gisplanners
Hello

I'm trying to access a secured service that requires a token. When I input the getToken url into a browser, I could get the token JSON response without any problem. However, when I try to execute it within my code as follows:

    NSURL *url = [NSURL URLWithString:@"http://.../getToken"];
    NSString *json = @"{\"accessKEY\":\"i...\"}";
    NSDictionary *jsonDict = [json AGSJSONValue];
    AGSJSONRequestOperation *jsonOp = [[[AGSJSONRequestOperation alloc] initWithURL:url queryParameters:jsonDict] autorelease];

Output:
{"GetToken":[{"Invalid Access":"IP Address"}]}

Any idea as to what may be the cause of the above problem? Any workaround?

Thanks.

Rgds
Ong CF

Outcomes