title: Getting Email Address from LinkedIn API
body: <p>I want to include a "Sign Up using LinkedIn" feature in my app.</p>
  
  <p>I'd like to be able to get some information, such as name and email.</p>
  
  <p>By default I am able to get a name, but I'm stuck on getting the email.</p>
  
  <p>My results are in JSON.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>- (IBAction)logInWithLinkedIn:(id)sender
  {
      if ([_client validToken])
      {
          [self requestMeWithToken:[_client accessToken]];
      }
      else
      {
          [_client getAuthorizationCode:^(NSString *code)
          {
              [self.client getAccessToken:code success:^(NSDictionary *accessTokenData) {
  
                  NSString *accessToken = [accessTokenData objectForKey:@"access_token"];
                  [self requestMeWithToken:accessToken];
  
              }                   failure:^(NSError *error) {
  
                  NSLog(@"Quering accessToken failed %@", error);
              }];
          }                      cancel:^{
  
              NSLog(@"Authorization was cancelled by user");
  
          }                     failure:^(NSError *error) {
  
              NSLog(@"Authorization failed %@", error);
          }];
      }
  }
  
  - (void)requestMeWithToken:(NSString *)accessToken
  {
      [self.client GET:[NSString stringWithFormat:@"https://api.linkedin.com/v1/people/~?oauth2_access_token=%@&amp;format=json", accessToken] parameters:nil success:^(AFHTTPRequestOperation *operation, NSDictionary *result) {
  
          NSLog(@"current user %@", result);
  
      }        failure:^(AFHTTPRequestOperation *operation, NSError *error) {
  
          NSLog(@"failed to fetch current user %@", error);
  
      }];
  }
  
  - (LIALinkedInHttpClient *)client
  {
      LIALinkedInApplication *application = [LIALinkedInApplication applicationWithRedirectURL:@"redirectURL"
                                                                                      clientId:@"key"
                                                                                  clientSecret:@"secret"
                                                                                         state:@"state"
                                                                                 grantedAccess:@[@"r_emailaddress"]];
      return [LIALinkedInHttpClient clientForApplication:application presentingViewController:nil];
  }
  </code></pre>
  
  <p>My result is:</p>
  
  <p>firstName</p>
  
  <p>headline</p>
  
  <p>lastName</p>
  
  <p>siteStandardProfileRequest</p>
  
  <p>Anyone see how I can get the email?</p>