Latest 0.2.3
Homepage https://github.com/trongdth/OAuth2-for-iOS
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit
Authors

OAuth2-for-iOS

It’s a library on iOS which is suitable for OAuth2. It supports authorization all websites which are using OAuth2 such as: smarthings, uber, fitbit, delivery, etc…

Build Status
Version
License
Platform
Carthage compatible

OVERVIEW

  1. https://github.com/lukeredpath/LROAuth2Client: I was developing based on this library. Basically, it covers > 80% the works. Please share and thanks him about this.

  2. https://github.com/nicklockwood/Base64: it’s base64 library I’m using for this library.

IMPROVEMENTS

  1. UI:

    • Use autolayout.
    • Use ARC.
    • Make UX better.
  2. Authorization:

    • Add initWithDict function for OAuthRequestController
    • Add Authorization key in order to avoid some website requires it.
  3. More things:
    • Fix warning and some small issues for LROAuth2Client
    • Upgrade lib to pod project for easy use.

Usage

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

  2. Declare OAuthRequestController:
NSMutableDictionary *dictService = [NSMutableDictionary dictionary];
[dictService setObject:@"https://www.fitbit.com/oauth2/authorize" forKey:kOAuth_AuthorizeURL];
[dictService setObject:@"https://api.fitbit.com/oauth2/token" forKey:kOAuth_TokenURL];
[dictService setObject:@"YOUR CLIENT ID" forKey:kOAuth_ClientId];
[dictService setObject:@"YOUR SECRET KEY" forKey:kOAuth_Secret];
[dictService setObject:@"YOUR CALLBACK URL" forKey:kOAuth_Callback];
[dictService setObject:@"activity heartrate location nutrition profile settings sleep social weight" forKey:kOAuth_Scope];

OAuthRequestController *oauthController = [[OAuthRequestController alloc] initWithDict:dictService];
oauthController.view.frame = self.view.frame;
oauthController.delegate = self;
[self presentViewController:oauthController animated:YES completion:^{

}];
  1. Implement OAuthRequestController method to obtain accesstoken:
- (void)didAuthorized:(NSDictionary *)dictResponse {
    NSLog(@"%@", dictResponse);
}

Installation

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

Author

Trong Dinh, [email protected]

License

OAuth2 is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "OAuth2",
    "version": "0.2.3",
    "summary": "It's used for OAuth2 authorization.",
    "description": "It's a library on iOS which is suitable for OAuth2. It supports authorization all websites which are using OAuth2 such as: smarthings, uber, fitbit, delivery, etc...",
    "homepage": "https://github.com/trongdth/OAuth2-for-iOS",
    "license": "MIT",
    "authors": {
        "Trong Dinh": "[email protected]"
    },
    "source": {
        "git": "https://github.com/trongdth/OAuth2-for-iOS.git",
        "tag": "0.2.3"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*.{h,m}",
    "resource_bundles": {
        "OAuth2": [
            "Pod/Classes/OAuthRequestController.xib"
        ]
    },
    "resources": [
        "Pod/Classes/OAuthRequestController.xib"
    ],
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This