Adding an OAuth2 Project on iOS

I am really trying to get OAuth2 in a project. I looked at all the different OAuth clients, but the documentation is minimal and the sample projects are out of date. All I want to do is get an authentication token with my clientID and secret hard code and use ARC / storyboards.

I tried OAuthConsumer, LROAuth2Client, GTM-OAuth2, OAuth2Client by nxtbgthng. Any tutorials, basic application examples, or those that you could point out to me would be great. The only examples of applications I can find are old and do not use ARC or storyboard.

+5
source share
2 answers
 - (id)init{
    self =  [super init];
    self.view.frame = CGRectMake(0, 0, 320, 480);
    [self.view setBackgroundColor:[UIColor whiteColor]];

    /*****OAUTHCLIENT SETUP*****/
    oauthClient = [[SBOAuth2Client alloc] initWithClientID:@"foo" secret:@"foo" redirectURL:[NSURL URLWithString:@"http://foo.com/"]];
    oauthClient.userURL  = [NSURL URLWithString:userUrl];
    oauthClient.tokenURL = [NSURL URLWithString:tokenUrl];
    oauthClient.delegate = self; 

    /*****WEBVIEW SETUP*****/
    webView = [[[UIWebView alloc] initWithFrame:CGRectMake(0, 20, 320, 460)] retain];
    [self.view addSubview:webView];
    return self;
}
+2
source

How in:

 webView = [[[UIWebView alloc] initWithFrame:CGRectMake(0, 20, 320, 460)] retain];

or

 if(webView==nil){
    //allocate it again
 }
 [oauthClient authorizeUsingWebView:webView];
+1
source

All Articles