bdbergeron / bdboauth1manager Goto Github PK
View Code? Open in Web Editor NEWOAuth 1.0a library for AFNetworking 2.x
License: MIT License
OAuth 1.0a library for AFNetworking 2.x
License: MIT License
This could support Swift Package Manager in a similar way to how AFNetworking does. This way, devs could consume this library using only tools built into Xcode, even if those devs don't use Swift
The current Cocoapod is fixed on AFNetworking 2.5.0 and I was curious if you had plan to push the updated podspec? We're using the BDBOAuth1Manager Coacopod and the v2.50 dependency locks us on that version. Not a huge issue and we can work around it but curious nonetheless. I'm assuming you are maintaining the podspec which may be a poor assumption.
iOS 7 & Mavericks have built-in Base64 support.
If it's included for compatibility with older OSes, couldn't it be conditional on the SDK used?
(BTW, thanks for this project! Works quite well.)
When you create a Yelp Developer Account they provide you with ready-made/fixed:
Consumer Key, Consumer Secret, Token, Token Secret.
I was wondering if it was possible to use your library without having to call: fetchAccessTokenWithPath:
(since you already have the token)
Hi,
This is more of a question about cocoapods, so sorry if this is the wrong place to ask! When integrating it into a vanilla Xcode project, using a Podfile with the use_frameworks!
option, I get complaints about not being able to find the correct header files. I can change the path of the #import
statements from:
#import "AFHTTPRequestOperationManager.h"
to
#import <AFNetworking/AFHTTPRequestOperationManager.h>
My symptoms are exactly as http://stackoverflow.com/questions/30262891/cocoapods-framework-cannot-find-file-in-another-cocoapods-framework, but I don't understand how to make this work.
Anyone have suggestions?
Thanks,
Charles
I am using Tumblr API. Tumblr have specifically designed their OAuth flow to replicate Twitter (which I know you are familiar with).
I copied your Twitter code but changed the URL endpoints and a few other things for tumblr.
I call the authorize method which calls fetchRequestTokenWithPath.
It opens up a Safari window.
App intersepts the callback and it calls fetchAccessTokenWithPath.
Every time I run the app, it ALWAYS FAILS the FIRST time but works the second time. This hinted to me that there was a problem with the code somewhere. Because my code doesn't change and is very simple, I looked into your code.
A NSDictionary is used in OAuthAuthorizationHeaderForMethod so if you have two query string params or two post data params with the same key the request is not signed properly.
OAuth spec lists how to handle multiple parameters with the same name in http://tools.ietf.org/html/rfc5849#section-3.4.1.3.2
Is there a way to skip params["oauth_token"] even when a user has been authenticated?
Hi there,
I would like to enhance the project in a few ways, but I noticed that there isn't any workspace/project files included. Can you please add them so that it is easy to work on the project?
Thanks,
Rudolph
Hi, I'm trying to migrate the old code from RSOAuthEngine to BDBOAuth1Manager (1.5.0). The migration run smoothly with login, logout, POST, and GET.
The problem comes when I try to upload image to the server and get Request failed: unauthorized (401).
NSURLSessionDataTask *task = [_networkManager POST:URLString parameters:parameters constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
[formData appendPartWithFormData:imagedata name:imagekey];
} success:^(NSURLSessionDataTask *task, id responseObject) {
// Success
} failure:^(NSURLSessionDataTask *task, NSError *error) {
// Fail
}];
I'm using afnetworking to communicate with a third party rest api that requires oauth1a ( yahoo boss and yelp api).
They provide me with a secret and key. I don't need a token or callback URL etc.
I'm using afnetworking.
How do I use this library.
Your help would be appreciated. All the examples do fancy URL callbacks etc.
I've got a crash which I can reproduce using the following steps:
This occurs even if I call deauthorize
on the session manager before attempting to log in again. Is there another call I should be making before reattempting the authentication?
2014-01-02 11:45:58.338 Skein[76189:70b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
*** First throw call stack:
(
0 CoreFoundation 0x0201a5e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01cd98b6 objc_exception_throw + 44
2 CoreFoundation 0x01fce9c2 -[__NSArrayI objectAtIndex:] + 210
3 CoreFoundation 0x02099608 -[NSArray objectAtIndexedSubscript:] + 40
4 Skein 0x0008eb40 -[NSDictionary(BDBOAuth1Manager) initWithQueryString:] + 640
5 Skein 0x0008e88b +[NSDictionary(BDBOAuth1Manager) dictionaryFromQueryString:] + 123
6 Skein 0x0008805a -[BDBOAuthToken initWithQueryString:] + 170
7 Skein 0x00087dcd +[BDBOAuthToken tokenWithQueryString:] + 141
8 Skein 0x0008d02c __94-[BDBOAuth1SessionManager fetchRequestTokenWithPath:method:callbackURL:scope:success:failure:]_block_invoke + 268
9 Skein 0x00074505 __72-[AFURLSessionManagerTaskDelegate URLSession:task:didCompleteWithError:]_block_invoke_280 + 213
10 libdispatch.dylib 0x02c8c7f8 _dispatch_call_block_and_release + 15
11 libdispatch.dylib 0x02ca14b0 _dispatch_client_callout + 14
12 libdispatch.dylib 0x02c8f75e _dispatch_main_queue_callback_4CF + 340
13 CoreFoundation 0x0207fa5e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
14 CoreFoundation 0x01fc06bb __CFRunLoopRun + 1963
15 CoreFoundation 0x01fbfac3 CFRunLoopRunSpecific + 467
16 CoreFoundation 0x01fbf8db CFRunLoopRunInMode + 123
17 GraphicsServices 0x032919e2 GSEventRunModal + 192
18 GraphicsServices 0x03291809 GSEventRun + 104
19 UIKit 0x00d15d3b UIApplicationMain + 1225
20 Skein 0x00005f6d main + 141
21 libdyld.dylib 0x02f3370d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
signal %d, info %p, uapVoid %p
Program ended with exit code: 0
In the latest version, I changed the internal method names for categories to use a prefix, as Apple suggests. Due to the likely use of the [NSDictionary dictionaryFromQueryString:] method by users when handling authorization callback URLs via the AppDelegate's openURL: method, I decided not to prefix it until I release the next minor version.
I am to sign in from Twitter api by iOS Application. Since I am using AFNetworking, I chose your code for it.
if (![[BDBTwitterClient sharedClient] isAuthorized])
{
dispatch_async(dispatch_get_main_queue(), ^{
[[BDBTwitterClient sharedClient] authorize];
});
}
I call the above code in action method of twitter sign in button. In the current viewController's view did load method I use:
[BDBTwitterClient createWithConsumerKey:kBDBTwitterClientOAuthConsumerKey secret:kBDBTwitterClientOAuthSecretKey];
And in app's target's info section, I have added a URL type with identifier as my bundle identifier and URL scheme of my own choice (JAWA_Twitter). I have used the same URL Scheme in your BDBTwitterClient class as: static NSString * const kBDBTwitterClientOAuthCallbackURL = @"JAWA_Twitter://authorize";
I am new to iOS Development, can you tell me how to get userInfo after it has logged in? I am using your TwitterClient.
Commit 8635b7b breaks our build. Doesn't this apply only if you build AFNetworking itself into a standalone framework called "AFNetworking"?
(We build BDBOAuth1Manager & AFNetworking into an OS X framework.)
Hi Brad
I have built a Cocoa Touch Framework written in Swift (using Xcode 7.2) utilising BDBOAuth1Manager 2.0.0 with no problem.
However, when I 'pod install' my aforementioned framework into a Swift standalone app (and as a result BDBOAuth1Manager gets installed as a dependency) I get the following errors when I try to build:
/Path/To/StandaloneApp/Pods/BDBOAuth1Manager/BDBOAuth1Manager/BDBOAuth1RequestSerializer.h:23:9: Include of non-modular header inside framework module 'BDBOAuth1Manager.BDBOAuth1RequestSerializer'
/Path/To/StandaloneApp/Pods/BDBOAuth1Manager/BDBOAuth1Manager/BDBOAuth1SessionManager.h:23:9: Include of non-modular header inside framework module 'BDBOAuth1Manager.BDBOAuth1SessionManager'
I've tried setting CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = 'YES'
, but didn't seem to help. I guess it wouldn't be an elegant solution anyway.
I've read through quite a few threads e.g 1 2 but couldn't really find a proper solution to my problem.
However, I came across this issue and the fix. I'm not sure if it's related but seems very much the same problem I'm facing.
Unfortunately, I know practically nothing about Obj C so can't really debug myself, but was wondering if you could look into this and perhaps give me some pointers if I could resolve this issue myself or does this require the same fix as the one for AFNetworking?
Or am I chasing a red herring?
Thanks
I just logged an issue (AFNetworking/AFNetworking/issues/2999) about AFNetworking 2.6 not percent-encoding slashes in the parameters. In particular, the oauth_callback
parameter's slashes are left intact, so I get a 401 Unauthorized error from Twitter's API.
Is there any approach from within BDBOAuth1Manager you can think of to work around this issue in the meantime?
Thanks.
This class is not included the pod anymore.
Hi
I found this issue when I try to use carthage to build the framework.
Fetching BDBOAuth1Manager
*** Checking out BDBOAuth1Manager at "2.0.0"
*** xcodebuild output can be found in /var/folders/hj/xzndmnhx0613xb46m68cwtq40000gn/T/carthage-xcodebuild.T9TfYv.log
*** Skipped building BDBOAuth1Manager due to the error:
Dependency "BDBOAuth1Manager" has no shared framework schemes for any of the platforms: iOS
If you believe this to be an error, please file an issue with the maintainers at https://github.com/bdbergeron/BDBOAuth1Manager/issues/new
Please advise if BDBOAuth1Manager cannot be installed by carthage?
I try to install with different version of BDBOAuth1Manager and none of them are installed successfully.
thank you for response.
Could we bump the AFNetworking dependency to 2.1.x? I'm stuck using a forked version since I need some of the 2.1 functionality in my app.
it only checks if accessToken is not nil, doesn't check if it's expired.
also, everytime saveToken is called, it assigns accessToken (even when we just received requestToken).
Currently BDBOAuth1RequestSerializer
subclasses AFHTTPRequestSerializer
but I want to be able to send requests that are serialized wth AFJSONRequestSerializer
due to the nature of the data I'm passing with the request. Is there a way to do this?
It seems that the OAuth signature is invalid for certain API providers. Not sure why it works for Twitter and not Copy, Bitbucket, Flickr, etc. I'll be looking into this problem later today.
Hi,
For some reason I got 1.0.2 from cocoapods. I had to add repo addresss to Podfile to get 1.0.4.
On a separate note, I bumped into a trouble while debuging my code. If request token is already downloaded and app tries to download it again, it gives "Request failed: unauthorized (401)" error. It took me a while to figure out why I was getting this error. Did you considered adding a check to fetchRequestToken method? Smth like snippet bellow would help a lot:
if(self.isAuthorized){
@throw([NSException exceptionWithName:@"Duplicate token request" reason:@"Can't fetch request token twice. Please deauthorize before fetching a new token" userInfo:nil]);
}
How can i use this with 2 legged oauth authentication....my api call are from drupal webservices...can i get an idea how to use this with drupal api where i only need consumer key and consumer secret to authenticate the user for api access......Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.