Search code examples
iosobjective-cxcodeinstagraminstagram-api

Invalid signed-request: Missing required parameter


I got the following response while getting my Photo from Instagram. Please help any help would be appreciated.

{ 
code = 403;
    "error_message" = "Invalid signed-request: Missing required parameter 'sig'";
    "error_type" = OAuthForbiddenException;
}

Here is my code

  NSURL *url = [NSURL URLWithString:@"https://api.instagram.com/v1/tags/nofilter/media/recent?access_token=...........aef2"];
    NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
    NSOperationQueue *queue = [[NSOperationQueue alloc] init];
    [NSURLConnection sendAsynchronousRequest:urlRequest queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {            
   if (error){
        }
        else {   
            NSString * a = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
            NSDictionary *tokenData = [jResponse objectWithString:a];
            NSLog(@"%@",tokenData);

        }
    }];

Solution

  • Looks like you have enabled Enforce Signed Requests, so it requires you to have sig parameter which is signature for API request, described here: https://www.instagram.com/developer/secure-api-requests/

    Either generate the signature or disable Enforce Signed Requests

    Looks like you are making API call from an app (client side), so it is not recommended to make signed request, since u have to save the client_secret in the app code. It is recommended to do this on the server to be secure. So just disable the Enforce Signed Requests for you app and make API call as is.