Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I want to create an IOS app that connects to my Office365 SharePoint team site using the list rest services. How do I do authentication? Any examples?

share|improve this question
    
Did you find the answer? –  surlac Sep 20 '12 at 12:29
add comment

2 Answers

As far as I know, you need to:
1) open UIWebView and direct user to authentication page of Identity Provider (Office 365, Google, etc.);
2) get FedAuth:

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
    NSArray *cookiesArray = [storage cookies];
    for (NSHTTPCookie *cookie in cookiesArray) {
        if ([[cookie name] isEqualToString:@"FedAuth"]) {

        }
    }
}

3) attach this token to every request you make to SharePoint services.

NSURLRequest.setAllHTTPHeaderFields()
share|improve this answer
    
This works, but the problem is, from what I understand, the cookie expires after 24 hours. So it's a pain to have to login every time you want to do some work. –  reallyseth Oct 9 '13 at 19:09
    
you also need rtFa cookie! you need to add them both with every request –  Radu Simionescu Mar 21 at 17:53
add comment

Can't mark it as a duplicate, but this should answer your question:

http://stackoverflow.com/questions/1557040/objective-c-best-way-to-access-rest-api-on-your-iphone

share|improve this answer
    
Will this work for claims based authentication in Office 365? –  HaavardMeling Sep 25 '11 at 11:37
    
Did you ever find out if it works with claims based auth? I'm having the same issue. –  Ryan Jun 19 '12 at 14:31
    
Unfortunately I have no idea, sorry. Anyone else? –  James Love Jun 19 '12 at 18:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.