calebd / simpleauth Goto Github PK
View Code? Open in Web Editor NEWSimple social authentication for iOS.
Home Page: http://simpleauth.io
License: MIT License
Simple social authentication for iOS.
Home Page: http://simpleauth.io
License: MIT License
For example, let's see at User Info block:
// User info
NSMutableDictionary *user = [NSMutableDictionary new];
user[@"nickname"] = remoteAccount[@"username"];
user[@"email"] = remoteAccount[@"email"];
user[@"name"] = remoteAccount[@"name"];
user[@"first_name"] = remoteAccount[@"first_name"];
user[@"last_name"] = remoteAccount[@"last_name"];
user[@"image"] = avatar;
if (location) {
user[@"location"] = location;
}
user[@"verified"] = remoteAccount[@"verified"];
user[@"urls"] = @{
@"Facebook" : remoteAccount[@"link"],
};
But my own profile has no Username and my app will crash when I try to authorize via Facebook.
Superb and really nice framework, I wish I would have find out this earlier, by the way can anyone enlighten me about which is the best way to implement logout mechanism ?
Hi @calebd
Came back to SimpleAuth after long time. You have done major progress by the time for SimpleAuth. There's one strange bug happening though. Here's the scenario:
I tried uninstalling both application. And installed first application again, but still the response object is NULL.
Created completely 2 fresh application but the problem didn't resolve. The namespace are different, both facebook applications are also different.
I deleted my account from Settings and installed the first application and then it starts working.
Not sure why this is happening, have to look into code. But can you confirm this is happening or not?
Line 16 causes an endless loop :)
if ((self = [super initWithOptions:options])) {
Should be:
if ((self = [super initWithOptions:options requestToken:requestToken])) {
I'm pretty sure I have everything set up correctly. When I launch my app, I get the Foursquare login screen. After I log in, the output from both the responseObject and error is (null). Any idea why?
Facebook/SimpleAuthFacebookProvider.m line 37
Undeclared selector 'responseDictionaryWithRemoteAccount:systemAccount:'
It seems to be typo...
Hi!
I've been looking at SimpleAuth in order to use it in my application and find it very interesting, but I have several questions to ask. One of my goals is to be able to connect my users via Facebook, Twitter or Foursquare.
Do you plan to add a fallback mechanism for the providers which have a web equivalent? (e.g. Facebook or Twitter) Or is it the responsibility of the user/developer to switch to the web provider when the native one doesn't work?
I read on your blog that you don't like having 3rd party SDKs in your app, and that it is one of the motives behind SimpleAuth ; nonetheless, I saw that you were planning on adding Foursquare to the providers. Will you use the official oauth framework? If not, how will you manage to do it?
I'm still analyzing your library and might integrate it in my app in the next few days, therefore I will probably implement the Foursquare provider.
I'll be glad to open a PR when and if my provider works well.
Thank you for the great lib. :)
Hello,
While implementing the Twitter provider, we stumbled upon a fringe issue: our iOS Twitter account was logged in the settings, but revoked on Twitter side (using their web interface).
Both remote calls remoteAccountWithSystemAccount
and accessTokenWithSystemAccount
occurs at the same time, that led to an issue if an error occurred during the first call.
Maybe you should differ the second call in this case.
NSArray *signals = @[
[RACSignal return:account],
[self remoteAccountWithSystemAccount:account],
[self accessTokenWithSystemAccount:account]
];
return [self rac_liftSelector:@selector(dictionaryWithSystemAccount:remoteAccount:accessToken:) withSignalsFromArray:signals];
In our case, the first one returned a 401 HTTP status code with a 89 error code (see Twitter's documentation for a full list of error codes), which should be handled to renew the account's credentials with [ACAccountStore renewCredentialsForAccount:completion:]
. Maybe this should even be extended to all 401 and 403 HTTP status codes without checking for specific Twitter error codes.
@amarcadet and I would have liked to help you on this one, but as we're not very fluent with ReactiveCocoa, we were afraid to mess up…
We are open to discuss of this one with you!
Hey Caleb,
I saw that you updated the podspecs, but have you submitted a PR to Cocoapods for the 0.3.1 release?
Thanks!
Hi!
What do you think about using constants for the keys in the configuration dictionaries?
It would be nice that each provider has the constants that it expects for the keys. I think that using simply strings its much error prone. Also, with the constants defined in each provider header file, the consumer would have more documentation about how to use the provider ;)
On including SimpleAuth via Cocoapods, I am getting following error in Pods-Contakt-LlamaKit :
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `X' in: -Xlinker
This line below cause error.
2014-09-15 15:55:32.027 Pregnant[3135:60b] -[__NSCFConstantString componentsJoinedByString:]: unrecognized selector sent to instance 0x6ae31c
2014-09-15 15:55:32.031 Pregnant[3135:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString componentsJoinedByString:]: unrecognized selector sent to instance 0x6ae31c'
if I use this only @"scope" : self.options[@"permissions"] . the return request is "nil"
I'll need to provide my own NSDictionary
<-> form encoded string implementation since that is going to be common among all providers.
@calebd Also it would be a lot better that you create a NSObject for SimpleAuthUser and fill the necessary properties in that. So in case someone requires a Facebook Access Token, expires at etc. it can be filled in the SimpleAuthUser class. What do you think?
Every time I try to log in using facebook-web I'm getting:
Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.
The FB app is correctly setup (I can connect using FB SDK)
Hi Caleb,
With @kornifex we are facing another issue when our user wants to cancel the authorize
request.
Sorry but we don't have time at the moment to fix this issue.
Maybe a simple Block_release
on the completion block in the main thread could do the job.
Let me know if you have better idea to handle this.
We may come back with a fix later this week.
Thanks for the hard work.
Antoine
One thing that seems to be missing is a method that performs a "silent login" attempt on login using a previously saved auth token. Without this, the user would need to re-log in to the app every time it launches.
Is this on the roadmap? We may try to figure this out ourselves, just wasn't sure if you had a plan for it already.
I was having trouble getting LinkedIn to work, using just the demo app. The web view would get displayed, but after entering my email and password, the web view would display "Request Error: We're sorry, there was a problem with your request. Please make sure you have cookies enabled and try again."
After modifying canonicalRequestForRequest to set HTTPShouldHandleCookies to YES, it started working.
Is this a known issue?
I have the following goals for a new version of SimpleAuth that solves many of the issues we see today:
SimpleAuthProvider
a subclass of NSOperation
SimpleAuth
class will maintain an instance of NSOperationQueue
to ensure serial operationsKeep getting this error:
Lexical or Preprocessor Issue 'SimpleAuthProvider.h' file not found
on #import "SimpleAuthProvider.h"
in SimpleAuthFacebookProvider.h
I am trying to add Google provider, but issue is that Google doesn't actually redirect to redirect_url, Normally in all other providers we use webViewhouldStartLoadWithRequest, instead of that we have to use webViewDidFinishLoad. Any suggestions regarding how to implement this without ruining the simplicity of the code ??
I am unable to install the provider for LinkedIn using the spec listed in the SimpleAuth.podspec file. Is LinkedIn still supported?
[!] Unable to find a specification named SimpleAuth/LinkedInWeb
in SimpleAuth (0.3.2)
.
[!] Unable to find a specification named SimpleAuth/LinkedIn
in SimpleAuth (0.3.2)
.
I've been getting SimpleAuthErrorDomain error 2 when using FB to login for the past week and a half or so.
This is the log I get:
Error Domain=SimpleAuthErrorDomain Code=2 "The operation couldn’t be completed. (SimpleAuthErrorDomain error 2.)" UserInfo=0x170c75480 {NSUnderlyingError=0x170252390 "The operation couldn’t be completed. (com.apple.accounts error 7.)"}
This could be done with one of two approaches:
Not sure which is better yet.
It would be cool if SimpleAuth worked with single-sign-on providers like Dropbox and Facebook. Fire off to one of those apps, come back, hand the URL to SipmleAuth, get tokens.
In SimpleAuthTwitterProvider.m, the UIActionSheet cancel button title is GENERAL_CANCEL
. Can that be changed to something less loud... like, Cancel
?
This may be a dumb question, but SimpleAuth does not provide a way to Authenticate instead of Authorize, right?
While trying to use Twitter-web, with the following code :
[SimpleAuth authorize:@"twitter-web" completion:^(id responseObject, NSError *error) {
NSLog(@"%@", responseObject);
NSLog(@"%@", error);
}];
I get the following error (and the UIWebView doesn't show up):
Error Domain=NSURLErrorDomain Code=-1012 "The operation couldn’t be completed. (NSURLErrorDomain error -1012.)" UserInfo=0xa972a80 {NSErrorFailingURLKey=https://api.twitter.com/oauth/request_token, NSErrorFailingURLStringKey=https://api.twitter.com/oauth/request_token, NSUnderlyingError=0xfc79580 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1012.)"}
Even if I made sure to setup the consumer key and the consumer secret !
I tried to login with Twitter and return responseObject nil then gives this error:
Error Domain=NSURLErrorDomain Code=-999 "The operation couldn’t be completed. (NSURLErrorDomain error -999.)" UserInfo=0x15f8dd60 {NSErrorFailingURLKey=https://twitter.com/intent/sessions, NSErrorFailingURLStringKey=https://twitter.com/intent/sessions}
I my pod-file i write:
pod 'SimpleAuth/FourSquare'
I go to terminal, locate my project folder and type: 'pod'
The error I receives is the following: "[!] Unable to find a specification named SimpleAuth/FourSquare
in SimpleAuth (0.3.2)
."
Edit: I have tried writing both Foursquare and FourSquare. The error is the same either way
After yesterday's commit, I facing a strange issue, Downloaded a new source and updating pods doesnt creating xcworkspace file in my project.
I dont know anything wrong with my configuration or there is some issue with new release.
When SimpleAuthLinkedInWebProvider calls the LinkedIn API to get the user's account, it doesn't pass in any field selectors, therefore only the default fields come back. Has anyone worked out an easy way to specify field selectors?
Here's the URL string that SimpleAuthLinkedInWebProvider constructs:
GET https://api.linkedin.com/v1/people/~?< query params >
To specify field selectors, you have to specify them in the resource path, like this:
GET https://api.linkedin.com/v1/people/~:(id,first-name,last-name,formatted-name,headline,location)?< query params >
@calebd First of all, thanks a lot for starting this repo. I was also thinking that there should be one library where you can pick and use which oauth system you want to use in your app. Was tired with facebook, twitter, google different handling. Is the library in usable state yet? I see that you're creating facebook, twitter's own repo as modules. Can you tell me a little bit more about your plans for this repo and if in some ways we can help.
Does SimpleAuth allow for using the API with the option of not authenticating the user, only authenticating the developer?
i.e. Just wanting to view a photo stream, no need to post anything (like, comment, etc).
- (void)presentActionSheet:(UIActionSheet *)actionSheet {
UIWindow *window = [UIWindow SimpleAuth_mainWindow];
[actionSheet showInView:window];
}
Not working on iOS8. It doesn't work because Apple changed internal implementation of UIActionSheet.
Can you please use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet?
Lines 72-74 of CMDQueryStringSerialization.m:
- (NSString *)cmd_stringByRemovingEscapes {
return [self stringByRemovingPercentEncoding];
}
[self stringByRemovingPercentEncoding] is iOS7 and above.
[self stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] is the functional equivalent and is backward compatible with iOS6.
for https://www.facebook.com/dialog/oauth? in SimpleAuthFacebookWebLoginViewController.h. I try to debug the generated facebok oauth url string.
What is the best way to debug so I know if the problem in SimpleAuthFacebookWebLoginViewController.h or in facebook setting? some facebok setting like redirect_uri? site_url? etc.
from
http://support.intenthq.com/support/articles/178390-creating-your-app-on-facebook-new-interface
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.