Latest 0.3
Homepage https://github.com/trongdth/OAuth1-for-iOS
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit, QuartzCore, SystemConfiguration
Authors

OAuth1-for-iOS

It’s a library on iOS which is suitable for OAuth1.

Build Status
Version
License
Platform
Carthage compatible

OVERVIEW

The idea based on FHSTwitterEngine (https://github.com/natesymer/FHSTwitterEngine) but has reduced more code and make it lightweight and suitable for all others OAuth1.

Usage

  1. To run the example project, clone the repo, and run pod install from the Example directory first.

  2. Declare FHSTwitterEngine:
[[FHSTwitterEngine sharedEngine] setDelegate:self];
    if([[FHSTwitterEngine sharedEngine] isAuthorized]) {
        NSLog(@"YES");
        [self callUserRequest];

    } else {
        NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@"https://api.twitter.com/oauth/access_token", kOAuth1_TOKEN,
                                                                        @"https://api.twitter.com/oauth/request_token", kOAuth1_REQUEST_TOKEN,
                                                                        @"https://api.twitter.com/oauth/authorize", kOAuth1_AUTHORIZE,
                                                                        @"yRtOrW7lOURB0lTSaTWlN2fMv", kOAuth1_CONSUMER_KEY,
                                                                        @"xOjRhL9mqzFf7Ie6Zv647K8FjPVeQyt2LcyPGAbkPYYae05VwP", kOAuth1_SECRET_KEY, nil];

        NSError *err = [[FHSTwitterEngine sharedEngine] authWithInfo:dict];
        if (!err) {
            UIViewController *loginController = [[FHSTwitterEngine sharedEngine]loginControllerWithCompletionHandler:^(BOOL success) {
                if(success) {
                    NSLog(@"YES");
                    [self callUserRequest];
                } else {
                    NSLog(@"NO");
                }
            }];
            [self presentViewController:loginController animated:YES completion:^{

            }];
        }

    }
  1. Implement FHSTwitterEngineAccessTokenDelegate method to obtain accesstoken:
- (void)oauth1Reponsed:(NSDictionary *)dict {
    NSLog(@"%@", dict);
}
  1. Call custom request:
- (void)callUserRequest {
    id data = [[FHSTwitterEngine sharedEngine] sendGETRequestForURL:[NSURL URLWithString:@"https://api.twitter.com/1.1/account/verify_credentials.json"] andParams:nil];
    NSLog(@"%@", data);
}

Installation

  1. Pod:
    • OAuth1 is available through CocoaPods. To install
      it, simply add the following line to your Podfile:
pod "OAuth1"
  1. Carthage:
    • For Carthage installation:
github "trongdth/OAuth1-for-iOS" "master"

Author

Trong Dinh, [email protected]

License

OAuth1 is available under the APACHE license. See the LICENSE file for more info.

Latest podspec

{
    "name": "OAuth1",
    "version": "0.3",
    "summary": "OAuth1 for iOS",
    "description": "It's a library on iOS which is suitable for OAuth1.",
    "homepage": "https://github.com/trongdth/OAuth1-for-iOS",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "trongdth": "[email protected]"
    },
    "source": {
        "git": "https://github.com/trongdth/OAuth1-for-iOS.git",
        "tag": "0.3"
    },
    "social_media_url": "https://twitter.com/trongdth",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "OAuth1/Classes/**/*.{h,m}",
    "frameworks": [
        "UIKit",
        "QuartzCore",
        "SystemConfiguration"
    ]
}

Pin It on Pinterest

Share This