|ReleasedLast Release||Dec 2014|
Maintained by Unclaimed.
A Project to make the pain of OAuth integration with Goodreads easier for Objective-C
My goal in creating this library is to make it as easy as possible to integrate Goodreads into an iOS app. All methods are class methods so that you don't need to pass an object everywhere you want to use the API. However, the result is that the UI for version 1.0 is not customizable without editing the source. If you have suggestions, requests or want to contribute, create an issue, email at [email protected], or just submit a pull request.
The underlying OAuth library is that of Christian Hansen and is available at https://github.com/Christian-Hansen/simple-oauth1. I made small modifications so that the library specifically supports Goodreads rather than LinkedIn.
git clone https://github.com/yjkogan/goodreads-oauth.git
Dependenciesdirectory, as well as the
.mfiles in your project. The easiest way to do this is to drag them into the file navigator of your project.
Initialize GROAuth with your API Keys by calling
[GROAuth setGoodreadsOAuthWithConsumerKey:YOUR_KEY secret:YOUR_SECRET]. It's recommended that you do this in
application: didFinishLaunchingWithOptions: in your appDelegate
To log the user in and (if they haven't already) ask them to authorize your app, just call
GROAuth loginWithGoodreadsWithCompletion:. This will present a webview on top of the current window through which the user can log in. If there is an error (user not authorizing your app, networking, etc.), it will be passed to your completion block. Else, you'll recieve a dictionary containing the
oauth_token_secret, which are the access tokens you need to sign your requests.
All paths sent to GROAuth should be the paths listed in the documentation for the Goodreads API, minus the leading
http://goodreads.com, so for example, if you wanted to use the
auth.user method, you would want to give the path
api/auth_user. This is concatonated onto the goodreads home URL. For some reason, not all api paths start with
There are a number of convenience methods for accessing data from Goodreads. The most important thing to point out though is that there are two versions for each method: one that requires access tokens and one that does not. Methods that don't require access tokens defaults to using the access tokens most recently acquired.
Another thing to be aware of is that the dictionaries returned from calls that return an NSDictionary are a bit of a pain to use. If anyone has suggestions for a better library than https://github.com/nicklockwood/XMLDictionary, please let me know.
Sending OAuth signed queries to API paths that don't require OAuth return an html document rather than an XML one, so these extra methods are necessary. If the request requires your key as a parameter (they probably all do, but I haven't checked yet), you can easily get it with
[GROAuth consumerKey]. The same qualification is true as with OAuth queries regarding NSDictionaries you get back.
Goodreads-OAuth is licensed under the MIT License
The MIT License (MIT)
Copyright (c) 2013 Yonatan Kogan
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.