Autenticación iOS con Facebook y verificación del lado del servidor.

My iOs app authenticates user with Facebook using facebook-sdk.

Now application connects to server and has to confirm that the user identity. Which is recommended way? Probably iphone has to send some kind of token to server and server has to confirm it with facebook api call

do you have link to these docs?

preguntado el 10 de marzo de 12 a las 03:03

1 Respuestas

hello u want to login with Facebook in your ios Application i have use this code for it pls check it first take web view in you r Application and do connection with Nib file .and enter your facebook Appl

- (void)viewDidLoad
[super viewDidLoad];

 NSString *client_id = @"Enter your Application ";

NSString *redirect_uri = @"";

NSString *url_string = [NSString stringWithFormat:@"", client_id, redirect_uri];

NSURL *url = [NSURL URLWithString:url_string];

NSURLRequest *request = [NSURLRequest requestWithURL:url];

[self.webView loadRequest:request];


 NSLog(@"%@",[webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.outerHTML"]);
- (void)webViewDidFinishLoad:(UIWebView *)_webView {

NSString *url_string = [((_webView.request).URL) absoluteString];

NSRange access_token_range = [url_string rangeOfString:@"access_token="];

//coolio, we have a token, now let's parse it out....
if (access_token_range.length > 0) {

    int from_index = access_token_range.location + access_token_range.length;
    NSString *access_token = [url_string substringFromIndex:from_index];

    NSLog(@"access_token:  %@", access_token);
   htmldata=[webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.outerHTML"];
    NSArray *arr1=[htmldata componentsSeparatedByString:@"<title>"];
    NSString *data=[arr1 objectAtIndex:1];
    NSArray *arr2=[data componentsSeparatedByString:@"</title>"];

    value=[[NSString alloc]initWithString:[arr2 objectAtIndex:0]];

    if([value isEqualToString:@"Success"])
        MainScreenController *C = [[MainScreenController alloc]init];
        [self.navigationController pushViewController:C animated:YES];
        [C release]; 


respondido 10 mar '12, 04:03

right now not any other ways to know login success .And otherway is using facebook dialog but you can not get any value from it sucess or not fail .u have change Api of the facebook sdk and Apple may be reject it. - Parag

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.