The AFOAuth1Client is an Objective-C library for making OAuth 1.0a authenticated requests.
Features
- Supports OAuth 1.0a authentication
- Easy integration with API endpoints requiring OAuth 1.0a
- Handles request signing and authentication headers
- Includes OAuth 1.0a signature methods (HMAC-SHA1, PLAINTEXT)
- Supports both synchronous and asynchronous API requests
- Simple setup and usage
Installation
You can install AFOAuth1Client using CocoaPods by adding the following line to your Podfile:
// Add this line to your Podfile pod 'AFOAuth1Client'
Then, run the following command:
pod install
Usage
To use AFOAuth1Client, follow these steps:
- Import the AFOAuth1Client header:
#import <AFOAuth1Client/AFOAuth1Client.h>
- Create an instance of AFOAuth1Client:
AFOAuth1Client *oauthClient = [[AFOAuth1Client alloc] initWithBaseURL:[NSURL URLWithString:@"https://api.example.com/"] key:@"YOUR_CONSUMER_KEY" secret:@"YOUR_CONSUMER_SECRET"];
- Perform an authenticated API request:
NSDictionary *parameters = @{@"param1": @"value1", @"param2": @"value2"}; [oauthClient postPath:@"/api/endpoint" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) { // Handle success response } failure:^(AFHTTPRequestOperation *operation, NSError *error) { // Handle failure response }];
Documentation and Examples
For detailed documentation and code examples, visit the official GitHub repository:
https://github.com/AFNetworking/AFOAuth1Client
Contributing
If you want to contribute to AFOAuth1Client, please follow the guidelines provided in the CONTRIBUTING.md file of the GitHub repository:
https://github.com/AFNetworking/AFOAuth1Client/blob/master/CONTRIBUTING.md
License
AFOAuth1Client is available under the MIT license. See the LICENSE file for more info.