title: Using NSURLSession delegate for authorization
body: <p>When <code>URLSession:didReceiveChallenge:completionHandler:</code> method of <code>NSURLSessionDelegate</code> is called? Did it called when I get response with 403 status code?</p>
  
  <p>Can I use this delegate method for authorization if I should change request body for second request after authorization? (I should change <code>@"ticket"</code>)</p>
  
  <pre><code>NSURLSession *session = [NSURLSession sharedSession];
  NSError *error;
  NSDictionary *mapData = @{
                            @"userIdentity": @{
                                    @"ticket": [SecretStorage sharedInstance].ticket,
                                    @"hotelId": [SecretStorage sharedInstance].hotelId,
                                    @"language": @"ru"
                                    }
                            };
  NSData *postData = [NSJSONSerialization dataWithJSONObject:mapData options:0 error:&amp;error];
  NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"example.com"]
                                                         cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                     timeoutInterval:60.f];
  [request addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
  [request setHTTPMethod:@"POST"];
  [request setHTTPBody:postData];
  
  NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                              completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
                                                  NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
                                                  NSLog(@"%@", json);
                                              }];
  [dataTask resume];
  </code></pre>